我想使用 C++ 通过 Gmail 发送电子邮件,就像从配置为使用 Gmail 帐户的桌面邮件客户端发送电子邮件一样。
我一直在寻找一些类似 jwSMTP 和 popen+sendmail 的工具,但它们看起来只有在主机是邮件服务器时才有效。我知道这个任务在 Python 中是一条很好的路径,但从未在 C++ 中尝试过。
感谢帮助! (c:
最佳答案
您将通过 gmail 的 smtp 服务器 (smtp.gmail.com) 发送邮件。客户端需要支持 SSL 或 TLS 才能连接。
Msmtp - http://msmtp.sourceforge.net/
libESMTP - http://www.stafford.uklinux.net/libesmtp/
它们都支持 SSL/TLS,应该可以很好地与 gmail 配合使用。使用 gmail 发送出站邮件的设置为:
Outgoing Mail (SMTP) Server (requires TLS or SSL): smtp.gmail.com
Use Authentication: Yes
Port for TLS/STARTTLS: 587
Port for SSL: 465
Account Name: your full email address (including @gmail.com or @your_domain.com)
Email Address: your email address (username@gmail.com or username@your_domain.com)
Password: your Gmail password
http://mail.google.com/support/bin/answer.py?hl=en&answer=13287
关于c++ - 使用 C++、Linux 通过 Gmail 发送电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2003539/