Results 1 to 35 of 35

Thread: How to send mail using vbsendmail.dll and smtp.gmail.com

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2008
    Posts
    17

    How to send mail using vbsendmail.dll and smtp.gmail.com

    Hello,

    I can send mail using smtp.gmail.com in vb.net. Recently i found vbsendmail.dll. But i can't send mail using smtp.gmail.com using vbsendmail.dll.

    It gives me an error: 530 Must StartTls command first.

    How to fix it. How can i send mail in visual basic 6 using smtp.gmail.com

    I used both username and password correctly. Please help me.

    Kindest regards...
    Shaoun

  2. #2
    Addicted Member ThorSubak's Avatar
    Join Date
    Apr 2008
    Location
    Cebu
    Posts
    153

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    did you try winsock control to send an email?

  3. #3
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Im confused. You are first stating that you're using VB.NET, but then you ask how to send a mail in VB6?

    Think yourself of being in our situation, do you think you've supplied us with enough information to solve your problem?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Apr 2008
    Posts
    17

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Hello,
    I can send mail in vb.net but i need to send mail in visual basic 6. I tried winsock in vb 6 and it returns an error i mentioned above. I used smtp.gmail.com as SMTP Server and 465 as port number. Please help me.

    It seems to me that i need to start ssl connection. but is it possible in vb 6.

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Apr 2008
    Posts
    17

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Hello,
    Now, i can understand the problem. Many server now requires SSL Connection. Now, my question is how to integrate SSL with Winsock. I want to send mail using winsock control and smtp.gmail.com

    That is why i need to integrate with my winsock control. Please help with code.

  6. #6
    New Member
    Join Date
    Apr 2008
    Posts
    7

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Quote Originally Posted by shaoun1000
    Hello,
    Now, i can understand the problem. Many server now requires SSL Connection. Now, my question is how to integrate SSL with Winsock. I want to send mail using winsock control and smtp.gmail.com

    That is why i need to integrate with my winsock control. Please help with code.
    Hi,
    is your problem Resolved? If so Please send me the code to send mail from Vb using smtp.gmail.com

    [Email address removed by moderator]

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Apr 2008
    Posts
    17

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Hello Kiran,
    It's too difficult to resolve the problem. As most of the popular smtp server use ssl encryption and visual basic 6 has no such option. But .net has default ssl installed and you can easily send mail using vb.net. If u want the code i can provide you here. I am still trying to create a solution for visual basic 6. But it is really too difficult. Sometimes almost impossible.
    Kindest regards...
    Shaoun

  8. #8
    New Member
    Join Date
    Apr 2008
    Posts
    7

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Hello Shaoun,
    Thanks for your quick Reply. I have .net codeto send the mail with smtp.gmail.com. But, my requirement is to send mail using Vb and any free smtp server only. Please let me know once you get it.

    Thanks & Regards,
    Kiran Kumar Chandaka.

  9. #9
    New Member
    Join Date
    Jul 2007
    Location
    Coimbatore, India
    Posts
    9

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Instead of using vbsendmail.dll try using this code to send mail using gmail in vb6. it works good for me

    Sub sendmail()
    Dim iMsg As Object
    Dim iConf As Object

    Dim Flds As Variant

    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")

    iConf.Load -1 ' CDO Source Defaults
    Set Flds = iConf.Fields
    With Flds
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "yourmail@gmail.com"
    .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "yourpasswordhere"
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    .Update
    End With

    strbody = "Your Sample message "

    With iMsg
    Set .Configuration = iConf
    .To = sendto
    .CC = ""
    .BCC = ""
    ' Note: The reply address is not working if you use this Gmail example
    ' It will use your Gmail address automatic. But you can add this line
    ' to change the reply address .ReplyTo = "Reply@something.com"
    .From = "<your mailid to be displayed as@gmail.com>"
    .Subject = "subject here"
    .TextBody = strbody
    .Send
    End With

    End Sub

  10. #10
    New Member
    Join Date
    Apr 2008
    Posts
    7

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Quote Originally Posted by shasunder
    Instead of using vbsendmail.dll try using this code to send mail using gmail in vb6. it works good for me

    Sub sendmail()
    Dim iMsg As Object
    Dim iConf As Object

    Dim Flds As Variant

    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")

    iConf.Load -1 ' CDO Source Defaults
    Set Flds = iConf.Fields
    With Flds
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "yourmail@gmail.com"
    .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "yourpasswordhere"
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
    .Update
    End With

    strbody = "Your Sample message "

    With iMsg
    Set .Configuration = iConf
    .To = sendto
    .CC = ""
    .BCC = ""
    ' Note: The reply address is not working if you use this Gmail example
    ' It will use your Gmail address automatic. But you can add this line
    ' to change the reply address .ReplyTo = "Reply@something.com"
    .From = "<your mailid to be displayed as@gmail.com>"
    .Subject = "subject here"
    .TextBody = strbody
    .Send
    End With

    End Sub

    Hi,
    The above code is giving me the following error,

    Run-time error '-2147220973 (80040213)':
    The transport failed to connect to server

    please let me know cause and how to rectify it....

    Thanks & Regards,
    Kiran

  11. #11
    New Member
    Join Date
    Jul 2007
    Location
    Coimbatore, India
    Posts
    9

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Did you try using gmail or other mail ?

  12. #12
    New Member
    Join Date
    Apr 2008
    Posts
    7

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Quote Originally Posted by shasunder
    Did you try using gmail or other mail ?
    Thank you for your reply. I tried using "smtp.gmail.com" and on different port no.s 25, 465, 587 as listed in gmail help site. but it didn't work on any of the ports...

  13. #13
    New Member
    Join Date
    Jul 2007
    Location
    Coimbatore, India
    Posts
    9

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    I am sorry and I really dont know why that issue is raising. It works fine for me and I tested this in other machines. it works fine. Since I am not able to duplicate the issue I cannot find the exact solution. Let me try to identify the cause of the issue and will let you know on the solution.

  14. #14
    New Member
    Join Date
    Apr 2008
    Posts
    7

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Quote Originally Posted by shasunder
    I am sorry and I really dont know why that issue is raising. It works fine for me and I tested this in other machines. it works fine. Since I am not able to duplicate the issue I cannot find the exact solution. Let me try to identify the cause of the issue and will let you know on the solution.
    Hi,
    Thank You very much for your reply. I will be waiting for your next reply with solution...

  15. #15
    New Member
    Join Date
    Jul 2007
    Location
    Coimbatore, India
    Posts
    9

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Could you please mention the OS that you use. whether you tried in Windows XP or some other OS?

  16. #16
    New Member
    Join Date
    Apr 2008
    Posts
    7

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Quote Originally Posted by shasunder
    Could you please mention the OS that you use. whether you tried in Windows XP or some other OS?
    I tried on both Windows XP and Windows 2000. But its giving me the same above error on both.

  17. #17
    New Member
    Join Date
    Aug 2008
    Location
    Saida, Lebanon
    Posts
    6

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Greetings...

    This code will work smoothly

    vb Code:
    1. <%
    2. On Error Resume Next
    3. Dim Subject, Body, SenderEmail, RecipientEmail, SMTPServer, SMTPusername, SMTPpassword
    4. SenderEmail = "Your Name <youremail>"
    5. SMTPserver = "smtp.gmail.com"
    6. SMTPusername = "your full email address"
    7. SMTPpassword = "your password"
    8. Subject = "Hello"
    9. Body = "This is a test. Please ignore."
    10. RecipientEmail= "any email address"
    11.  
    12. sch = "http://schemas.microsoft.com/cdo/configuration/"
    13. Set cdoConfig = CreateObject("CDO.Configuration")
    14. With cdoConfig.Fields
    15. .Item(sch & "smtpauthenticate") = 1
    16. .Item(sch & "smtpusessl") = True
    17. .Item(sch & "smtpserver") = SMTPserver
    18. .Item(sch & "sendusername") = SMTPusername
    19. .Item(sch & "sendpassword") = SMTPpassword
    20. .Item(sch & "smtpserverport") = 465
    21. .Item(sch & "sendusing") = 2
    22. .Item(sch & "connectiontimeout") = 100
    23. .update
    24. End With
    25.  
    26. Const cdoSendUsingPickup = "c:\inetpub\mailroot\pickup"
    27. Set cdoMessage = CreateObject("CDO.Message")
    28. With cdoMessage
    29. Set .Configuration = cdoConfig
    30. cdoMessage.From = SenderEmail
    31. cdoMessage.To = RecipientEmail
    32. cdoMessage.Subject = Subject
    33. cdoMessage.TextBody = Body
    34. cdoMessage.Send
    35. End With
    36. Set cdoMessage = Nothing
    37. Set cdoConfig = Nothing
    38. If Err.Number <> 0 Then
    39.   Response.Write (Err.Description& "<br><br>")
    40. end if
    41. %>

  18. #18
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Hello and welcome to vbforums.
    Correct me if Im wrong, but isnt that vbscript?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  19. #19
    New Member
    Join Date
    Aug 2008
    Location
    Saida, Lebanon
    Posts
    6

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Thank you Atheist, and i hope i will be usefull here

    And yes it's a vbscript, the guys above were searching for anything will send an email using the gmail smtp either than .Net, so here it is, it can be used in an .asp file or vb6 application.

    kiran9866650520 already posted the solution but he had a mistake with the port number.

  20. #20
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    You don't need to fiddle with those godawful schema strings as shown above. Just set a reference to the proper library (since you really want early binding anyway) and you have proper named constants for all of them at your fingertips.

    In VB you can use the bang (!) syntax to shorten the typing even a hair more.

    Instead of the clunky:
    Code:
    With cdoConfig.Fields
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "yourmail@gmail.com"
    .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "yourpasswordhere"
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
    .Item("http://schemas.microsoft.com/cdo/configuration/connectiontimeout") = 100 
    .Update
    End With
    You can simply write:
    Code:
    With cdoConfig.Fields
        !cdoSMTPUseSSL = True
        !cdoSMTPAuthenticate = cdoBasic
        !cdoSendUserName = "yourmail@gmail.com"
        !cdoSendPassword = "yourpasswordhere"
        !cdoSMTPServer = "smtp.gmail.com"
        !cdoSendUsingMethod = cdoSendUsingPort
        !cdoSMTPServerPort = 465
        !cdoSMTPConnectionTimeout = 100
        .Update
    End With

    If the code is to be VBScript, it's a question of your script host. For WSH you can write the script as a .WSF instead of a naked .VBS file, which also allows you to specify a reference to the CDO library and get those handy named constants. For ASP you can put the reference in global.asa to gain the same thing. Of course you're still stuck with late binding.

    Since you have no bang operator though, you'll need to spell out the full .Item(x) syntax, using the constants for x as appropriate:
    Code:
    With cdoConfig.Fields
        .Item(cdoSMTPUseSSL) = True
        .Item(cdoSMTPAuthenticate) = cdoBasic
        .Item(cdoSendUserName) = "yourmail@gmail.com"
        .Item(cdoSendPassword) = "yourpasswordhere"
        .Item(cdoSMTPServer) = "smtp.gmail.com"
        .Item(cdoSendUsingMethod) = cdoSendUsingPort
        .Item(cdoSMTPServerPort) = 465
        .Item(cdoSMTPConnectionTimeout) = 100
        .Update
    End With

    Maybe the funniest thing is the idea that .Net can do this! The equivalent in the .Net Framework namespaces is a COM-interop wrapper over exactly this same CDO for Windows library. Hah.

  21. #21
    New Member
    Join Date
    Apr 2008
    Posts
    7

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Quote Originally Posted by bachir8k
    Greetings...

    This code will work smoothly

    vb Code:
    1. <%
    2. On Error Resume Next
    3. Dim Subject, Body, SenderEmail, RecipientEmail, SMTPServer, SMTPusername, SMTPpassword
    4. SenderEmail = "Your Name <youremail>"
    5. SMTPserver = "smtp.gmail.com"
    6. SMTPusername = "your full email address"
    7. SMTPpassword = "your password"
    8. Subject = "Hello"
    9. Body = "This is a test. Please ignore."
    10. RecipientEmail= "any email address"
    11.  
    12. sch = "http://schemas.microsoft.com/cdo/configuration/"
    13. Set cdoConfig = CreateObject("CDO.Configuration")
    14. With cdoConfig.Fields
    15. .Item(sch & "smtpauthenticate") = 1
    16. .Item(sch & "smtpusessl") = True
    17. .Item(sch & "smtpserver") = SMTPserver
    18. .Item(sch & "sendusername") = SMTPusername
    19. .Item(sch & "sendpassword") = SMTPpassword
    20. .Item(sch & "smtpserverport") = 465
    21. .Item(sch & "sendusing") = 2
    22. .Item(sch & "connectiontimeout") = 100
    23. .update
    24. End With
    25.  
    26. Const cdoSendUsingPickup = "c:\inetpub\mailroot\pickup"
    27. Set cdoMessage = CreateObject("CDO.Message")
    28. With cdoMessage
    29. Set .Configuration = cdoConfig
    30. cdoMessage.From = SenderEmail
    31. cdoMessage.To = RecipientEmail
    32. cdoMessage.Subject = Subject
    33. cdoMessage.TextBody = Body
    34. cdoMessage.Send
    35. End With
    36. Set cdoMessage = Nothing
    37. Set cdoConfig = Nothing
    38. If Err.Number <> 0 Then
    39.   Response.Write (Err.Description& "<br><br>")
    40. end if
    41. %>
    Hi,
    I Tried using the above code in my application but its again givving some error saying " The transport failed to connect to Server "

  22. #22
    New Member
    Join Date
    Aug 2008
    Location
    Saida, Lebanon
    Posts
    6

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Ok guys, this is a new code i am working with now, its more better because even hotmail will put your email in the inbox and not in the junk.

    Code:
    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
    Set Flds = iConf.Fields
    
    schema = "http://schemas.microsoft.com/cdo/configuration/"
    Flds.Item(schema & "sendusing") = 2
    Flds.Item(schema & "smtpserver") = "smtp.gmail.com" 
    Flds.Item(schema & "smtpserverport") = 465
    Flds.Item(schema & "smtpauthenticate") = 1
    Flds.Item(schema & "sendusername") = "youremail@gmail.com"
    Flds.Item(schema & "sendpassword") =  "yourpassword"
    Flds.Item(schema & "smtpusessl") = 1
    Flds.Update
    
    With iMsg
    	.To = "info@bachir.com"
    	.From = "Bachir El Charif <info@bachir.com>"
    	.Sender = "Bachir.com"
    	.ReplyTo = "info@bachir.com"
    	.Subject = "A message from Bachir."
    	.HTMLBody = "This is a html email, please ignore"
    	.Organization = "Bachir"
    	Set .Configuration = iConf
    	SendEmailGmail = .Send
    End With
    
    set iMsg = nothing
    set iConf = nothing
    set Flds = nothing
    in either way you should be aware that your email will be from youremail@gmail.com even if you have entered a different value for the from parameter.
    if you want your client to receive an email from your website email address, you should configure your website and create a google webmail application for your website, but you should have all access on your domain configuration such as DNS Records.

    good luck
    Last edited by bachir8k; Jan 30th, 2009 at 08:13 PM.

  23. #23

    Thread Starter
    Junior Member
    Join Date
    Apr 2008
    Posts
    17

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Ok. It is no more a standard thing to use CDO object for sending mails. I forgot vb6 and transferred to vb.net 2. Here is a extensive class (Mailmessage class) that works perfectly with all email client.

    Thanks.

  24. #24
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Quote Originally Posted by bachir8k View Post
    Ok guys, this is a new code i am working with now, its more better because even hotmail will put your email in the inbox and not in the junk.

    Code:
    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
    Set Flds = iConf.Fields
    
    schema = "http://schemas.microsoft.com/cdo/configuration/"
    Flds.Item(schema & "sendusing") = 2
    Flds.Item(schema & "smtpserver") = "smtp.gmail.com" 
    Flds.Item(schema & "smtpserverport") = 465
    Flds.Item(schema & "smtpauthenticate") = 1
    Flds.Item(schema & "sendusername") = "youremail@gmail.com"
    Flds.Item(schema & "sendpassword") =  "yourpassword"
    Flds.Item(schema & "smtpusessl") = 1
    Flds.Update
    
    With iMsg
    	.To = "info@bachir.com"
    	.From = "Bachir El Charif <info@bachir.com>"
    	.Sender = "Bachir.com"
    	.ReplyTo = "info@bachir.com"
    	.Subject = "A message from Bachir."
    	.HTMLBody = "This is a html email, please ignore"
    	.Organization = "Bachir"
    	Set .Configuration = iConf
    	SendEmailGmail = .Send
    End With
    
    set iMsg = nothing
    set iConf = nothing
    set Flds = nothing
    in either way you should be aware that your email will be from youremail@gmail.com even if you have entered a different value for the from parameter.
    if you want your client to receive an email from your website email address, you should configure your website and create a google webmail application for your website, but you should have all access on your domain configuration such as DNS Records.

    good luck




    Nice example but do you have an example not using only gmail? Like for example I have this configuration on my outlook:


    STMTP Server: mail.mywebsite.com
    SMTP Port: 25
    DNS Server: 123.123.123.123
    Pop3 Server: mail.mywebsite.com
    POP3 Port: 110
    Username: myusername
    password: mypassword

    How do I configure this one? And also how to attach a file?
    Last edited by shyguyjeff; Apr 20th, 2009 at 06:45 AM.

  25. #25
    New Member
    Join Date
    Aug 2008
    Location
    Saida, Lebanon
    Posts
    6

    Smile Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    hi shyguyjeff

    Code:
    Flds.Item(schema & "sendusing") = 2
    Flds.Item(schema & "smtpserver") = "mail.mywebsite.com" 
    Flds.Item(schema & "smtpserverport") = 25
    Flds.Item(schema & "smtpauthenticate") = 1
    Flds.Item(schema & "sendusername") = "myusername"
    Flds.Item(schema & "sendpassword") =  "mypassword"
    Flds.Item(schema & "smtpusessl") = 0
    in some cases the username should be a valid email account under your domain ex: "sender@mywebsite.com" so it will not work if you just use "sender"

    and to attach a file use this within "With iMsg":
    .AddAttachment "c:\bachir.txt"


  26. #26
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    In my case i have DNS Server, Pop3 Server and Pop3 port. I try to use my smtp server only but it will not send. There is a message saying "The transport failed to connect to the server".

  27. #27
    New Member
    Join Date
    Aug 2008
    Location
    Saida, Lebanon
    Posts
    6

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    POP3 is an incoming mail server and not outgoing and you should use SMTP in order to send mails, some servers configurations require authentication in order to use the SMTP, or else anyone can use your server ip's to send mass mailing. Usually the authentications are the same as the pop3 accounts.

    Concerning the DNS, there is no need to use it, as your domain name is already configured to be redirected to your hosting account with the pre-configured name servers ex: ns1.pixels-lab.com, ns2.pixels-lab.com.

    but i guess in your case your server is configured only to send emails from the same ip (within your website), and it don't need any authentication.

    try this:
    Code:
    Flds.Item(schema & "sendusing") = 2
    Flds.Item(schema & "smtpserver") = "mail.mywebsite.com" 
    Flds.Item(schema & "smtpserverport") = 25
    Flds.Item(schema & "smtpauthenticate") = 0
    Flds.Item(schema & "sendusername") = "myusername"
    Flds.Item(schema & "sendpassword") =  "mypassword"
    Flds.Item(schema & "smtpusessl") = 0
    Let me know if it will work.

  28. #28
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Still it doesn't work... I tried it and it say "The server rejected one or more recipient addresses. The server response was 553 Sorry, that domain isn't in my list of allowed rcphosts." ..Why it is still not sending. My Outgoing Port is given to me 3535.. I configured my outlook and everything is going fine.

  29. #29
    New Member
    Join Date
    Aug 2008
    Location
    Saida, Lebanon
    Posts
    6

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    we can spend ever in here to solve this problem, but you have 4 choices to solve ur problem:

    1- Switch to .Net (see above to learn more about which class you should use.)
    2- Configure your hosting account and use Google apps and then use the above code.
    3- Create a new ftp account and a new email account called sender@yourdomain.com and send them to me with their passwords and i will see if i can solved it.
    4- Switch to another hosting account, and if you like i will give you a free 1 year hosting on my server, and then u can use Google apps and i will send you all the codes you need to work smoothly on my server.

    I prefer the choice number 2, because i like to know what will be the solution for your problem, and to be helpful for other users in the future.

    Thanks

  30. #30
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    thanks bachir8k..Ok i will try your first and second advice then if the same problem occur then i will post here. Have a nice day bachir8k.

  31. #31
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    now it is working bachir8k..I just misconfigured my ports in ssl port. I check the website of my hosting i got the point there. Thanks a lot bachir8k. Now i will be working to get the feedback from the recipient's server. If they will accept or the mail bounceback and what are the specific errors. Do you have a any ideas on how to get the SMTP Status codes bachir8k?
    Last edited by shyguyjeff; Apr 27th, 2009 at 01:55 AM.

  32. #32
    Hyperactive Member shyguyjeff's Avatar
    Join Date
    Jul 2007
    Location
    City of Durian
    Posts
    289

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Hello everyone, is there anyone can get the bounce back emails using this setup? I was stock on this part. One thing also I want is that everytime I send email to the receiver, how can I remove the words "on behalf of" in the from area of the message? Thanks everyone.

  33. #33
    New Member
    Join Date
    Oct 2010
    Posts
    2

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Hi the above code works well in sending the mail,can you help me with the code to get an email receipt? because i need to know if the email got to the recipient or not

  34. #34
    Junior Member
    Join Date
    Oct 2010
    Location
    Zagreb
    Posts
    29

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    can someone tell me, please, what parameters or functions or something like that, of the following code should be declared in code. I have declared only iMsg, iConf, Flds and schema, all as string.

    When I start the code it gives this error: "Invalid qualifier" and marks iConf in line 3: Flds = iConf.Fields

    Quote Originally Posted by bachir8k View Post
    Ok guys, this is a new code i am working with now, its more better because even hotmail will put your email in the inbox and not in the junk.

    Code:
    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
    Set Flds = iConf.Fields
    
    schema = "http://schemas.microsoft.com/cdo/configuration/"
    Flds.Item(schema & "sendusing") = 2
    Flds.Item(schema & "smtpserver") = "smtp.gmail.com" 
    Flds.Item(schema & "smtpserverport") = 465
    Flds.Item(schema & "smtpauthenticate") = 1
    Flds.Item(schema & "sendusername") = "youremail@gmail.com"
    Flds.Item(schema & "sendpassword") =  "yourpassword"
    Flds.Item(schema & "smtpusessl") = 1
    Flds.Update
    
    With iMsg
    	.To = "info@bachir.com"
    	.From = "Bachir El Charif <info@bachir.com>"
    	.Sender = "Bachir.com"
    	.ReplyTo = "info@bachir.com"
    	.Subject = "A message from Bachir."
    	.HTMLBody = "This is a html email, please ignore"
    	.Organization = "Bachir"
    	Set .Configuration = iConf
    	SendEmailGmail = .Send
    End With
    
    set iMsg = nothing
    set iConf = nothing
    set Flds = nothing

  35. #35
    New Member
    Join Date
    Oct 2010
    Posts
    2

    Re: How to send mail using vbsendmail.dll and smtp.gmail.com

    Morris_Zg did you declare the variables?

    HTML Code:
    Dim iMsg As Object
    Dim iConf As Object
    
    Dim Flds As Variant

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width