我正在尝试使用php将用户以HTML格式插入的该用户信息发送到我的电子邮件地址:
$to = "[email protected]";
$subject = "Delete Listing";
$email = $_REQUEST['Email'] ;
$message = $_REQUEST['Filename'] && $_REQUEST['reason'];
$headers = "From: $email This File needs to be removed in 48 hrs.Please review it and act accordingly.";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }
但是我想我不确定在$ message处使用两个$ _REQUEST ...这就是为什么在发送电子邮件时出现错误。(其他部分将执行“我们在发送您的邮件时遇到错误”)
尝试 :
$message = "I'm an example.";
mail('[email protected]', 'Delete Listing', $message);
如果收到此消息,则可以使用完整的代码。
尝试使用FastMailBuilder类,易于使用:
(new FastMailBuilder)
->to('[email protected]')
->from('New Site', '[email protected]')
->subject('Delete Listing')
->text(
"This File needs to be removed in 48 hrs. Please review it and act accordingly."
)->html(
"This File needs to be removed in 48 hrs. <strong>Please review it</strong> and act accordingly."
)->send();
php.ini上的典型配置如下所示:
[mail function]
SMTP = smtp.isp.net
sendmail_from = [email protected]
在此处了解更多信息:如何通过PHP mail()函数使用Gmail或Yahoo
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句