[英]Gmail IMAP php mail send as reply of email
I want to send an email as reply in gmail through my Laravel CRM system. 我想通过我的Laravel CRM系统在gmail中发送电子邮件作为回复。
My code is as below: 我的代码如下:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: '.Auth::user()->f_name.' '.Auth::user()->l_name.'<'.$gmail_address.'>'." \r\n" .
'Reply-To: <'.$gmail_address.'>'. "\r\n" .
'Subject: '.$subject."\r\n".
'To: '.$to."\r\n".
'In-Reply-To: <56F15324.7050704@xxxx.xxx>'. "\r\n" .
'References: <56F15324.7050704@xxxx.xxx>'. "\r\n" .
'X-Mailer: PHP/' . phpversion();
imap_mail ( $to , $subject ,$body,$headers);
But it sends it as a new email, ie not as a reply. 但它将其作为新电子邮件发送,即不作为回复。
Ideally it should add "Re: " to subject and append the actual email at the end of reply email body. 理想情况下,它应该添加“Re:”到主题并在回复电子邮件正文的末尾附加实际的电子邮件。
Any Help please.. 任何帮助请..
Your In-Reply-To
and References
headers are hardcoded to some magic value; 您的
In-Reply-To
和References
标题被硬编码为一些神奇的值; that's probably not what you want to do. 这可能不是你想要做的。
Here is how I would improve the code: 以下是我将如何改进代码:
l_name
produce a non-compliant message. l_name
中的任何非ascii字符很可能会产生不符合要求的消息。 Read the whole RFC5322 to understand how e-mails work. Message-Id
of the message(s) that you're replying to, and set your own In-Reply-To
& References
headers accordingly. Message-Id
,并相应地设置您自己的In-Reply-To
& References
标头。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.