需要解决方案:
我已经在PHP中编写了一个代码,我可以在phpmailer的帮助下发送电子邮件到gmail id,但是使用相同的代码我无法发送到个人域名的电子邮件是av@msdesigns.co.in。
当我发现这个问题时,所拍的电子邮件只被砍成a.v@msdesigns而不是a.v@msdesigns.co.in。
<?php
require($_SERVER['DOCUMENT_ROOT'].'/PHPMailer/class.phpmailer.php');
require($_SERVER['DOCUMENT_ROOT'].'./PHPMailer/class.smtp.php');
$To = htmlentities($_POST['sendersName']);
echo $To;
$From = htmlentities($_POST['sendersEmail']);
echo $From;
$Subject = htmlentities($_POST['sendersMessage']);
echo $Subject;
$mail = new PHPMailer();
$mail->Body ="Name :-" .$To. "\n <br>"."From :-" .$From. "\n <br>"."Subject :-" .$Subject. "\n <br>";
$mail->IsSMTP();
$mail->SMTPAuth = true; #enable SMTP authentication
$mail->SMTPSecure = "ssl"; #sets the prefix to the server
$mail->Host = "smtp.gmail.com"; #sets GMAIL as the SMTP server
$mail->Port = 465; #set the SMTP port
$mail->Username = "a@gmail.com"; #your gmail username
$mail->Password = "yourpassword"; #Your gmail password
$mail->From = $From; #your gmail id
$mail->FromName = $To; #your name
$mail->Subject = "Message From".$To;
$mail->WordWrap = 150;
$mail->AddAddress("a@gmail.com","abc");
$mail->AddAddress("a@gmail.com","abc");
$mail->AddAddress("a.v@msdesigns.co.in","Msd");
$mail->IsHTML(true); // send as HTML
if(!$mail->Send())
{
echo "Mailer Error: " . $mail->ErrorInfo;
}
else
{
echo "Message has been sent";
}
?>