我使用的是Gmail API https://developers.google.com/gmail/api/v1/reference/。
但是我找不到像- FROM,TO,CC,BCC,REPLY-TO这样的带有名字和地址的消息信息。需要输出为-
$msg['fromAddress'] = 'fromemail@gmail.com';
$msg['fromName'] = 'From Name';
$msg['to'] = array('John Lok' => 'johnlok@gmail.com', 'Smither Fan'=>'smither@gmail.com');
$msg['cc'] = array('krish Hosa' => 'krish23@gmail.com', 'Singam Hat'=>'singhamso@gmail.com');
$msg['bcc'] = array('Loban' => 'lobandash@gmail.com', 'Krain Root'=>'krainroot@gmail.com');
$msg['body'] = 'sample Message Text';
$msg['attachments'] = array('Flower.jpg' => 'https://filelink.com/files/Flower-d9edkifsk3edmfsdf94rffjofs.jpg', 'Bill List.pdf'=>'https://filelink.com/files/Bill-List-34324234mfskfsofsc.pdf');
$msg['reply-to'] = array('From Name' => 'fromemail@gmail.com');
发布于 2020-11-06 20:16:08
Gmail API要求这些邮件头满足RFC2822的要求。然后,所有这些头文件都应该编译成RFC4648中定义的URL安全字符串。Here您可以看到这种发送邮件方法的示例。
我知道您需要从现有邮件中读取这些标题。如果这是正确的,那么您只需逆转前一种方法。首先,您需要使用users.messages.get()
来读取现有邮件的一个实例。在raw
字段中,它存储在前面提到的URL安全字符串中。如果还有什么疑问,请问我。
https://stackoverflow.com/questions/64705094
复制相似问题