If you are using some other server like godaddy or some other server for that you need to put the settings of that particular server in its setting. I am sharing the settings for godaddy server.
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent
$mail->Port = 25; // set the SMTP port for the YourServer server
$mail->Host = "smtpout.secureserver.net"; // sets the SMTP server
$mail->Username = "yourusername@server.com"; // SMTP account username
$mail->Password = "yourpassword"; // SMTP account password
$mail->SetFrom('email to be visible to recipient', 'name visible to recipient');
$mail->Subject = 'Your subject';
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML('Your message');
$mail->AddAddress($email);
$mail->SMTPDebug = 0;
$mail->Send(); // Clear all addresses and attachments for next
0 Comment(s)