我想使用C ++ / curl和Visual Studio 2015发送电子邮件,它将是html格式,如下所示:
Hello World!
代替
<strong>Hello World!</strong>
如何格式化它以便客户端将文本读取为text / html而不仅仅是纯文本?
我已经拥有的代码(不起作用)看起来像这样:
const wchar_t tekst[] = _T("<html><body><p>Hello World</p></body></html> ");
_bstr_t temp(tekst);
const char* tekst_maila = temp;
static const char *payload_text[] = {
"Date: Mon, 29 Nov 2020 21:54:29 +1100\r\n",
"To: " TO "\r\n",
"From: " FROM "(Example User)\r\n",
"Cc: " CC "(Another example User)\r\n",
"Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@"
"rfcpedant.example.org>\r\n",
"Subject: SMTP TLS example message\r\n",
"\r\n", /* empty line to divide headers from body, see RFC5322 */
/* body starts here */
tekst_maila,
};
我找到了一些答案,如下:
A very basic HTML email is described below:
From: Test Address <your-email_at_domain.com>
Reply-To: Test Address <your-email_at_domain.com>
To: libcurl development <curl-library_at_cool.haxx.se>
Subject: Test Email
Date: Mon, 09 Jan 2012 10:00:00 +0000
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
Mime-version: 1.0
<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii">
</head>
<body>
<p>Hello World</p>
</body>
</html>
但是如何实际实现呢?