Skip to content

how to use external smtp to send email using vb6 exe prog?

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #188981
    method
    Member

    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

    #188991

    well 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=nothing

    #188990

    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 😆

    #188989
    method
    Member

    @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

    #188988

    to 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 😆

    #188987
    method
    Member

    Thanks 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

    #188986

    to 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 😆

    #188985

    dam thing, someone try my code and send me a email, please replace my email as yours to do test. 😈

    #188984
    method
    Member

    nanomachine007 is it possible to send attachment using this code ? I be happy if u show me how.Thanks

    #188983

    @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”)

    #188982
    Admin
    Administrator

    lol 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 🙂

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.