Hi Experts!
I am using the following code send email from Excel. But this do not show any error. But not sending an email.
Please give me a solution.Sub send_email_via_Gmail() Dim myMail As CDO.Message Set myMail = New CDO.Message myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smptauthenticate") = 1 myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com" myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "" myMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "" myMail.Configuration.Fields.Update With myMail .Subject = "Test Email from AmirSoft" .From = "" .To = "[email protected]" .CC = "" .BCC = "" .TextBody = "Good morning!" .AddAttachment "" End With On Error Resume Next myMail.Send 'MsgBox("Mail has been sent") Set myMail = Nothing End Sub
I shall be very thankful to you.
Regards
Amir
Bookmarks