Hi

change port no. to 465 also you need to enable smpt / imap services for
your Google account

Cheers
On Mar 7, 2015 5:48 PM, "Ashish Bhalara" <ashishbhalar...@gmail.com> wrote:

> Dear experts,
>
> I want mail from excel using gmail ID. I want to mail from data sheet by
> filtering data of mail receivers. I find the code using google search as
> mention below but it's error occur of "The transport failed to connect to
> the server." during the running code. Kindly help me regarding this matter.
>
>
> Sub CDO_Mail_Small_Text_2()
>     Dim iMsg As Object
>     Dim iConf As Object
>     Dim strbody As String
>     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";)
> = "Full GMail mail address"
>         .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword";)
> = "GMail password"
>         .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 = "Hi there" & vbNewLine & vbNewLine & _
>               "This is line 1" & vbNewLine & _
>               "This is line 2" & vbNewLine & _
>               "This is line 3" & vbNewLine & _
>               "This is line 4"
>
>     With iMsg
>         Set .Configuration = iConf
>         .To = "Mail address receiver"
>         .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 = "re...@something.nl"
>         .From = """YourName"" <re...@something.nl>"
>         .Subject = "Important message"
>         .TextBody = strbody
>         .Send
>     End With
>
> End Sub
>
> Regards.
> Ashish Bhalara
> 9624111822
> P*Please do not print this email unless it is absolutely necessary.
> Spread environmental üawareness.♣♣♣*
>
>  --
> Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s
> =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @
> https://www.facebook.com/discussexcel
>
> FORUM RULES
>
> 1) Use concise, accurate thread titles. Poor thread titles, like Please
> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
> will not get quick attention or may not be answered.
> 2) Don't post a question in the thread of another member.
> 3) Don't post questions regarding breaking or bypassing any security
> measure.
> 4) Acknowledge the responses you receive, good or bad.
> 5) Jobs posting is not allowed.
> 6) Sharing copyrighted material and their links is not allowed.
>
> NOTE : Don't ever post confidential data in a workbook. Forum owners and
> members are not responsible for any loss.
> ---
> You received this message because you are subscribed to the Google Groups
> "MS EXCEL AND VBA MACROS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to excel-macros+unsubscr...@googlegroups.com.
> To post to this group, send email to excel-macros@googlegroups.com.
> Visit this group at http://groups.google.com/group/excel-macros.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/d/optout.

Reply via email to