我正在使用gmail api,我试图将以下代码作为邮件发送
例如:
我发送此
<tr>
<td style="font-family:Arial, Helvetica, sans-serif; font-size:9px;">
<a>Buy what you wish & Get Flat 5% off Use: HOLIDAY5</a>
</td>
</tr>
在邮件中我收到了
<tr>
<td>
<a>Buy what you wish & Get Flat 5% off Use: HOLIDAY5</a>
</td>
</tr>
我的所有内联样式都消失了
我的帖子请求是
var from= 'From: '+name+' <'+email+'>\r\n';
var to='To: Me '+' <'+to+'>\r\n';
var subject= 'Subject: '+subj+'\r\n';
var mail='<html><body>'+sHTML+'</body></html>';
var message = from + to + subject +
'Content-Type: text/html; charset=utf-8\r\n' +
'Content-Transfer-Encoding: quoted-printable\r\n\r\n' +
mail;
var ss=new Buffer(message).toString('base64');
var rawdata = ss.replace(/\//g, '_').replace(/\+/g, '-');
//发送POST请求
var headers={'Authorization': 'Bearer ' + google.accessToken}
var options={contentType: "application/json"};
var res = HTTP.post('https://www.googleapis.com/gmail/v1/users/me/messages/send',{params: options,headers: headers,data: {'raw':rawdata}});