Send email via Gmail account
Gmail SMTP server requires SSL connection on port 465.
Known Gmail limits on sending emails:- An attachment size is limited to 25 MB
- An individual email can be sent to maximum of 100 recipients
- A large number of undeliverable messages could trigger an account lockdown
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 * Replace addresses with real ones before running the code loMail = NEWOBJECT("Cdo2000", "Cdo2000.fxp") WITH loMail .cServer = "smtp.gmail.com" .nServerPort = 465 .lUseSSL = .T. .nAuthenticate = 1 && cdoBasic .cUserName = "yourGmailAccount@gmail.com" .cPassword = "yourGmailPassword" * If From address doesn't match any of the registered identities, * Gmail will replace it with your default Gmail address .cFrom = "yourGmailAccount@gmail.com" .cTo = "somebody@otherdomain.com, somebodyelse@otherdomain.com" .cSubject = "CDO 2000 email through Gmail SMTP server" * Uncomment next lines to send HTML body *.cHtmlBody = "<html><body><b>This is an HTML body<br>" + ; * "It'll be displayed by most email clients</b></body></html>" .cTextBody = "This is a text body." + CHR(13) + CHR(10) + ; "It'll be displayed if HTML body is not present or by text only email clients" * Attachments are optional * .cAttachment = "myreport.pdf, myspreadsheet.xls" ENDWITH IF loMail.Send() > 0 FOR i=1 TO loMail.GetErrorCount() ? i, loMail.Geterror(i) ENDFOR * Clear errors loMail.ClearErrors() ELSE ? "Email sent." ENDIF
Comments
Thanks - this is very helpful
Exactly what I need
Exactly what I need!
How to send HTML file as email body
Send HTML file as email body
If HTML includes images, you'll have to use cHtmlBodyUrl property of the class.
HTML body
lcHtmlFileName='report03-01-2010.mht'
.cHtmlBodyUrl = "file://" + FULLPATH(lcHtmlFileName)
giving me error as below
ERROR: :1429 # send # 103 # 0x00000216 CDO.Message.1 The content type was not valid in this context. For example, the root of an MHTML message must be an HTML document.
warm regards,
mk.
Re: HTML body
Re: Re: HTML body
How can I send the MHTML file created with XFRX?
warm regards,
mk.
Sending email with CDO 2000
Great post. Thank you.
Can I save a message directly to Gmail folder?
Re: Can I save a message directly to Gmail folder?
Thank you for your answer.
You cannot do that with CDO
Perfect
How to Display real name instead of email address
I want to display name actual name instead of my email address
How to display my name "Yeo" in the from field instead of bgx3088@gmail.com.
Rgrds and Thanks
Yeo
Re:How to Display real name instead of email address
Send multiple messages
But how can I put it inside a loop, so that I can send different messages to different people ?
e.g. in a payroll system, to send monthly pay slip to diferent people
Re: Send multiple messages
Something like
Error when sending email
<strong>1429# send #188 #0x00000213 The transport failed to connect to the server.</strong>
We are using a google apps acount, on port 587 and ssl true.
Is there any specific reason as to why this is happening.
Re:Error when sending email
Ok thank you
Failed to connect to server
I was very happy to find such an excellent solution of sending mail from VFP. However...
I also receive this error message, "not able to connect to server", when I was sending
to a GMX account and tried both 25 and 587 ports.
Some servers have a wait time of 30 seconds when they receive mail through port 25,
because they want to avoid spam mails. Do you know of any problems sending through
GMSX and using port 25?
Greetings from Germany
Hans
Re: Failed to connect to server
Only port 465 can be used with CDO 2000 to access Gmail.
Sorry for my blindnes
... false alarm...
I did not see, that you actually mentioned, that GMX requires port 465.
Sorry for bothering you. And THANK YOU for your nice work.
Cheers
Hans
Thank you for this code
CDO No Longer Working
I have been using your the above code to send emails via Gmail for years without any issues.
Last week I upgraded from Outlook 2002 to Outlook 2010 and it appears as thought CDO has been uninstalled.
I get "Class Definition CDO.Configuration is not found".
I did search Universalthread and located the CDOSYS.DLL but REGSVR32.EXE would not register it.
I am using Windows 7 64 bit.
Any ideas
Best regards
Kevin
Problem with attachments
The odd thing is, if I step through this code in the command window, it works. When I realized that, I tried putting delays at various places in the process, to make sure the PDF was really completely created and the attachment was really "attached," but it hasn't helped.
Has anyone else seen this problem? Any ideas for resolving it?
Re: Problem with attachments
It's not clear where error occurs.
PDF File Size increasing Automatically and not opening
hi Allen : Same thing happened with me. I am also using windows 7 .
I have watched that attachment PDF file size is increasing by 2KB.
Hence the same message is coming "A file I/O error has occurred".
Any solution please.
Excelent !
Thanks
excellent prg but ...
excellent prg under vfp9 it works very well but under my app standalone when i execute this procedure in my logiciel.exe error : cdo.configuration not found
thanks
Option to preview email before sending
Error sending email
1 ERROR::1429 # send # 226 # 0x00000213 CDO.Message.1 The transport failed to connect to the server
I had the same issue
So I then logged into the mail account (Outlook.com)
It asked me to verify some details (and use that Captcha nonsense)
Then I tried emailing again and all was sweet
Error
New 1429 error
Error while emailing to blahblah@gmail.com. ERROR #1429 send # 182 # 0x0000020F
The email option performs a FILETOSTR in order to read a template html file off the harddrive, performs substitution on the template text and then displays the msg on screen BEFORE it is sent. When its sent, the text is set as the email html body. Again, this error only started after moving to a new server. Any ideas?
When I try to send mail with
I am receiving ERROR: 1429 # send 530 # 0x00000213 CDO.Message.1 The transport failed to connect to the server
It works in our network. But in another network gives this error. Where should I look at?
Putting CDO2000 emails into Gmail's Draft box?
Thanks.
2015 - VFP9 and Windows 7 64x - Still works sending smtp mail !
Using VFP9 and Windows 7 64-bit and got your routine to work.
I've been trying many other solutions for the past few hours with no success.
I'm Using Dreamhost Mail SMTP and here are my settings:
WITH loMail
.cServer = "mail.yourdreamhostname.com"
.nServerPort = 587
.lUseSSL = .N.
.nAuthenticate = 1 && cdoBasic
.cUserName = 'myname@yourdreamhostname.com'
.cPassword = "password4myname"
* If From address doesn't match any of the registered identities,
* Gmail will replace it with your default Gmail address
.cFrom = 'myname@yourdreamhostname.com'
.cTo = 'recipient_name@gmail.com'
Thanks again!
error sending SMTP mail from windows server 2003
CDO2000 code works fine for operating systems win xp,win 7
but it fails for windows server 2003
error message is as follows
ERROR: :1429 # send # 164 # 0x00000213 CDO.Message.1 The transport failed to connect to the server.
Delivery confirmation
Many thanks for your kind assistance!
Re: Delivery confirmation
See https://support.microsoft.com/en-us/kb/302839 and https://www.berezniker.com/comment/284#comment-284
Gracias
Gmail Usage
ERROR:1429#send#1230x00004e05 The requested body part was not found in the message.
When I use his gmail credentials on my computer, all works well. When he uses my credentials on his computer, he gets the same failure message. Any suggestion as to where to look first on his computer? I'm happy the app works OK and that it is not the gmail account.
Jim
my wishes
problem to send
ERROR:1429#send#1230x00004e05
will solved