你好!下面是一个使用 C 语言发送邮件到 QQ 邮箱的示例:
首先,你需要安装和配置 libcurl 库,这是一个用于处理网络传输的库,支持多种协议,包括 SMTP。你可以在这里获取 libcurl 库:https://curl.haxx.se/libcurl/
然后,你可以使用下面的代码来发送邮件:
``` #include <stdio.h> #include <curl/curl.h>
int main(void) { CURL *curl; CURLcode res;
curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, CURLOPT_URL, "smtp://smtp.qq.com:587"); curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL); curl_easy_setopt(curl, CURLOPT_USERNAME, "your-email@qq.com"); curl_easy_setopt(curl, CURLOPT_PASSWORD, "your-email-password"); curl_easy_setopt(curl, CURLOPT_MAIL_FROM, "