Tag: mailer

Set up PHP mailer on Go Daddy

Popular hosting provider GoDaddy imposes very strict (to the point of becoming almost useless) constraints on sending an email. They block outbound SMTP to ports 25, 465 and 587 to all servers except their own.

If you find your script works on your local machine, but not when you upload it to GoDaddy, then you’ll have to refrain from using SMTP attributes in your PHP mail script. Instead, you can simply use Go Daddy’s web mailer to configure PHP mailer and provide the host name, username and password to enable sending  mails on your script. Use the following code after configuring your webmailer:

$mail = new PHPMailer;

$mail->Host = 'localhost';              // Specify this option as localhost
$mail->Username = 'info@yourdomain.com';// webmailer username
$mail->Password = 'your pwd';           // webmailer password
$mail->Port = 587;                      // TCP port to connect to

  
$mail->setFrom('your from mail address', 'From name');

$mail->addAddress(recipientemail);      // Add a recipient in $email

PS : You might get following errors while trying to run PHP mailer with SMTP on Go Daddy :

Error : PHPMailer- Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting