简体   繁体   English

使用gmail作为SMTP中继器在Windows中以C ++发送邮件

[英]Send mail in c++ in windows using gmail as smtp relayer

Does anyone know how to send an email with an attachment(txt file) using a gmail as an smtp relayer in windows environment.I have looked at some sample code here but that was for the linux os. 有谁知道如何在Windows环境中使用gmail作为smtp中继器来发送带有附件(txt文件)的电子邮件。我在这里查看了一些示例代码,但这是针对linux操作系统的。 So far i could not find any sample code for windows.Help would be appreciated. 到目前为止,我找不到Windows的任何示例代码。不胜感激。

Google mail server will only accept secure connection, SSL or TLS. Google邮件服务器仅接受安全连接,SSL或TLS。 Here are the addresses and ports GMail uses: http://support.google.com/mail/bin/answer.py?hl=en&answer=13287 以下是GMail使用的地址和端口: http : //support.google.com/mail/bin/answer.py? hl=zh_CN& answer= 13287

So, you need to use SSL/TLS-enabled socket like this one: CSslSocket - SSL/TLS enabled CSocket . 因此,您需要像这样使用启用SSL / TLS的套接字: CSslSocket-启用SSL / TLS的CSocket

Or, if you want to implement SMTP over SSL yourself, using SChannel API , this sample will guide you through: C++ SSPI Schannel TLS example (this shows how to break through SSL and you are to complete with with SMTP plain text conversation sending an email). 或者,如果您想使用SChannel API通过SSL实现自己的SMTP,此示例将指导您完成: C ++ SSPI Schannel TLS示例 (此示例显示了如何突破SSL,并且您将完成SMTP纯文本会话发送电子邮件的步骤) )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM