- This topic has 10 replies, 3 voices, and was last updated 18 years ago by BattleStar-Galactica.
-
AuthorPosts
-
April 7, 2006 at 2:18 am #188981methodMember
Hi all. i am new to vba. i be happy if some one send me the code on how to use external smtp to send email using a vb6 .exe program.Thanks
April 7, 2006 at 4:46 am #188991BattleStar-GalacticaMemberwell i use vbnet and vbscript to send email by using gmail smtp
I’m vbnet and c# programmer but not really in vb but here it’s the code to send mail with vbscript using gmail.
Set myMail=CreateObject(“CDO.Message”)
myMail.Subject=”Sending email with CDO”
myMail.From=”mymail@mydomain.com”
myMail.To=”xxxx@gmail.com”
myMail.TextBody=”This is a message.”
myMail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/sendusing”)=2
myMail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/smtpauthenticate”)=1
myMail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/sendusername”)=”youraccount@gmail.com”
myMail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/sendpassword”)=”yourpassword”
myMail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/smtpserverport”)=465
myMail.Configuration.Fields.Item (“http://schemas.microsoft.com/cdo/configuration/smtpusessl”)=true
myMail.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserver”)=”smtp.gmail.com”
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothingApril 7, 2006 at 5:39 am #188990BattleStar-GalacticaMemberI do the test for vb, it’s ok too, this code works for vb too, hope it can be useful for you method
enjoy coding and coding for fun 😆April 7, 2006 at 8:46 pm #188989methodMember@nanomachine007 wrote:
I do the test for vb, it’s ok too, this code works for vb too, hope it can be useful for you method
enjoy coding and coding for fun 😆Many thanks for both of u. nanomachine007 could u tell me how i can use this code in visual studio version 6? I am new to vb so i be happy if u tell me the steps to use this code and make .exe file and one a click of a button it sends the email and shows a confirmation massge.Thanks
April 7, 2006 at 9:47 pm #188988BattleStar-GalacticaMemberto use the code i posted you have to create a gmail account and copy that code to your sub button click and replace youraccount@gmail.com by your gmail account and your password by your real gmail account password.
to create the file .exe go to microsoft visual studio 6.0 tool, click on package&deployment wizar, it will tell you the next step to make your exe file.
and for the confirm message in vb6 they have the statement to intercept the error >>> On Error goto and On Error Resume next, you can use
On Error goto 1
code to send mail here
message send mail success
exit sub
1:
message error here
me too i’m not really good in vb, i just can do some basic thing 😥
loco maybe have more info about that, hey loco show him some trick 😆April 7, 2006 at 11:38 pm #188987methodMemberThanks nanomachine007 i made it to work!! But now i want to know how i can send ip address and mac address of mechine with the email. Loco i hope u or any expert help me here.Thanks
myMail.TextBody=”This is a message.” ====> add ip address and mac address
April 8, 2006 at 5:55 pm #188986BattleStar-GalacticaMemberto find the ip address of the machine that runs your app, it’s not hard.
under your project add a winsock compoment and you can get it by calling winsock.localip, for MAC address, i dont know, i never try to get it, how is the utility to get MAC of other machine???? but I think loco know how to get maybe you have to wait he read you post 😆April 13, 2006 at 8:14 pm #188985BattleStar-GalacticaMemberdam thing, someone try my code and send me a email, please replace my email as yours to do test. 😈
April 18, 2006 at 5:42 pm #188984methodMembernanomachine007 is it possible to send attachment using this code ? I be happy if u show me how.Thanks
April 19, 2006 at 1:07 am #188983BattleStar-GalacticaMember@method wrote:
nanomachine007 is it possible to send attachment using this code ? I be happy if u show me how.Thanks
yep you can do it by adding this line after your message
myMail.AddAttachment(“c:youfile.txt”)
April 21, 2006 at 11:25 am #188982AdminAdministratorlol guys u hook me up sorry I dint reply sooner lol but I guess u guys figure stuff out, but let me just tell ya this code righ here is going to help me big time for a new program I am workign on 🙂 ah only vip members will be able to get if for now lol, let me make u vip I should be finish soon on it check the vip section 🙂
-
AuthorPosts
Related
- You must be logged in to reply to this topic.