我正在尝试使用示例中所示的 php 邮件类。
http://www.vulgarisoip.com/category/phpgmailer/
我正在使用我网站的联系我们表格。我可以将“$mail->From”地址设置为填写表格的人吗?当我收到邮件时,它总是显示“发件人地址”作为我的 gmail 帐户。任何帮助都会非常有帮助。
<?php
require_once('phpgmailer/class.phpgmailer.php');
$mail = new PHPGMailer();
$mail->Username = 'username@gmail.com';
$mail->Password = 'gmailpassword';
$mail->From = 'from@hotmail.com'; // Like to set this address as the address of the person who filled the form
$mail->FromName = 'User Name';
$mail->Subject = 'Subject';
$mail->AddAddress('myname@mydomain.com'); // To which address the mail to be delivered
$mail->Body = 'Hey buddy, heres an email!';
$mail->Send();
?>