Hello,
I am working on a macro that identifies the username, asks for the account password and sends out an email from Gmail.
I tested it using my personal gmail account and worked like a charm with the default settings smtp.gmail.com and port 25.
However, I couldn't manage to make it work for the actual company account.
Since my company uses Gmail with a custom domain, (my email address is, say, John.Smith@CompanyX.com), I figured I had to change smtp.gmail.com to smtp.CompanyX.com
I have also tried using different ports (465,587) but nothing has worked so far and I keep getting several run time errors (80040213, 80040217..)...
I could really use some help, especially to identify the correct smtp and port for this domain.
Any ideas?
Thank you.
Set Mail = New CDO.Message
'Enable SSL Authentication
Mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
'Make SMTP authentication Enabled=true (1)
Mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
'Set the SMTP server and port Details
'Get these details from the Settings Page of your Gmail Account
Mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
"smtp.gmail.com" 'I have also tried with the domain smtp.CompanyX.com
Mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 'I have also tried 465,587
Mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Set your credentials of your Gmail Account
Mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = _
Application.Username
Mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = _
InputBox("Enter Password")
I am working on a macro that identifies the username, asks for the account password and sends out an email from Gmail.
I tested it using my personal gmail account and worked like a charm with the default settings smtp.gmail.com and port 25.
However, I couldn't manage to make it work for the actual company account.
Since my company uses Gmail with a custom domain, (my email address is, say, John.Smith@CompanyX.com), I figured I had to change smtp.gmail.com to smtp.CompanyX.com
I have also tried using different ports (465,587) but nothing has worked so far and I keep getting several run time errors (80040213, 80040217..)...
I could really use some help, especially to identify the correct smtp and port for this domain.
Any ideas?
Thank you.
Set Mail = New CDO.Message
'Enable SSL Authentication
Mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
'Make SMTP authentication Enabled=true (1)
Mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
'Set the SMTP server and port Details
'Get these details from the Settings Page of your Gmail Account
Mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
"smtp.gmail.com" 'I have also tried with the domain smtp.CompanyX.com
Mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25 'I have also tried 465,587
Mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Set your credentials of your Gmail Account
Mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = _
Application.Username
Mail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = _
InputBox("Enter Password")