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 hostname, username and password to enable sending mails on your script. Use the following code after configuring your webmailer:
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
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 hostname, username and password to enable sending mails on your script. Use the following code after configuring your webmailer:
1 2 3 4 5 6 7 8 9 10 11 | $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
No comments:
Post a Comment