sending email with gmail smtp ( secure layer ) in c++(在 C++ 中使用 gmail smtp(安全层)发送电子邮件)
问题描述
有人在 gmail smtp 服务器上取得了成功吗?smtp.gmail.com从 C++ 代码发送电子邮件?我知道它使用安全层,但我不知道如何实现这样一个.
does any one had success with gmail smtp servers ? smtp.gmail.com to send emails from c++ code ? i know its using secure layer but i have no idea how to implement such one .
推荐答案
这是我用的,不过它是为 linux 设计的,技术上应该可以在 windows 上工作
This is what i used, It was for linux though, It should Technically work on windows
http://johnwiggins.net/jwsmtp/
教程在那里,直截了当
http://johnwiggins.net/jwsmtp/example1.html
这是来自显示端口和 SMTP 服务器的站点的复制和粘贴.归功于约翰·维金斯
Here is a copy and paste from the site showing Ports and SMTP Server. Credit goes to john wiggins
jwsmtp::mailer mail(to.c_str( ),
from.c_str( ),
subject.c_str( ),
mailmessage.c_str( ),
smtpserver.c_str( ),
jwsmtp::mailer::SMTP_PORT,
false);
验证
mail.username("loginname");
mail.password("secret");
mail.authtype(mailer::PLAIN);
目前只支持LOGIN和PLAIN认证,默认LOGIN,设置为 PLAIN 调用 authtype 函数
Currently only LOGIN and PLAIN authentication are supported, LOGIN by default, to set to PLAIN call the authtype function
这篇关于在 C++ 中使用 gmail smtp(安全层)发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 C++ 中使用 gmail smtp(安全层)发送电子邮件


基础教程推荐
- 在 C++ 中计算滚动/移动平均值 2021-01-01
- C++结构和函数声明。为什么它不能编译? 2022-11-07
- 这个宏可以转换成函数吗? 2022-01-01
- 如何将 std::pair 的排序 std::list 转换为 std::map 2022-01-01
- 如何通过C程序打开命令提示符Cmd 2022-12-09
- 常量变量在标题中不起作用 2021-01-01
- 如何检查GTK+3.0中的小部件类型? 2022-11-30
- 如何在 C++ 中初始化静态常量成员? 2022-01-01
- 静态库、静态链接动态库和动态链接动态库的 .lib 文件里面是什么? 2021-01-01
- 我有静态或动态 boost 库吗? 2021-01-01