Please tell me how to make the phpmailer module work for siteground hosting?
I noticed that if I comment or remove $mail->isSMTP(); this line, sending mail starts working. But this breaks the logic of my code, because I cannot display success message
Also works if i replace $mail->isMail(); instead of $mail->isSMTP();
Does this mean that SMTP is blocked by the hosting?
My PHPMailer SMTP Config is:
<?php
MAIL_FROM = 'MAIL_ACC_CREATED_ON_SITEGROUND.com',
MAIL_SMTP_HOST = 'mail.mydomain.com',
MAIL_SMTP_PORT = 465;
MAIL_SMTP_USERNAME = 'MAIL_ACC_CREATED_ON_SITEGROUND.com',
MAIL_SMTP_PASSWORD = 'password';
$mail->isSMTP();
$mail->SMTPAuth = true;
$mail->Host = MAIL_SMTP_HOST;
$mail->Port = MAIL_SMTP_PORT;
$mail->Username = MAIL_SMTP_USERNAME;
$mail->Password = MAIL_SMTP_PASSWORD;
$mail->SMTPSecure = 'ssl';
I would be grateful for any tip and help!
I don't know how, but I fixed this problem. The problem was my code, not the hosting.
Related
I have site i have created contact us page i want to send mail in users. i have makes the php mailer code but hen ever i submit the contact us button the issue is coming like this(SMTP Error: Could not connect to SMTP host.) please help what is i did wrong.
My PHP mailer code:
$mail = new PHPMailer;
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl';
$mail->Host = "smtpout.secureserver.net";
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = "what is the username";
$mail->Password = "what is the password";
$mail->setFrom('mail#sell.com', 'Raja');
$mail->addAddress($email , $name);
$mail->isHTML(true);
$mail->send();
You're using GoDaddy
You're using encryption, which GoDaddy doesn't support
You're using authentication, which GoDaddy doesn't support
You've disabled debug output so you have no feedback on what's going on, though you won't get much when using ssl mode to port 465 if the server doesn't support it
You have no error checking, so you have no idea where it's breaking - base your code on the examples provided with PHPMailer.
You're using an old version of PHPMailer; get the latest
You've not read what the PHPMailer troubleshooting guide says about GoDaddy
You didn't search before you posted
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = '********#gmail.com';
$mail->Password = '********';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
When I am using IsSmtp() message does not send it will stop on send.
When I remove IsSmtp() mail send properly but it gives the following error:
escapeshellcmd() has been disabled for security reasons
Just add $mail->isSMTP(); That will avoid using escapeshellcmd().
I've been researching for 3 weeks now on how to configure SMTP using PHPMailer for GoDaddy but none of it works. Tried contacting the GoDaddy support but they haven't replied yet. And I haven't seen any documentation on how to setup SMTP on their server.
I've been changing the Host many times, tested them, but none of it were successful in sending the email. I surpassed the error (using PHPMailer debug) but when I checked the email, I couldn't see any messages being received.
These are the hosts I've tried:
$mail->Host = "smtp.office365.com";
$mail->Host = "smtpout.secureserver.net";
$mail->Host = "relay-hosting.secureserver.net";
$mail->Host = "localhost";
Also, I've tried the settings in PHPMailer troubleshooting, but it won't work.
$mail->isSMTP();
$mail->Host = 'relay-hosting.secureserver.net';
$mail->Port = 25;
$mail->SMTPAuth = false;
$mail->SMTPSecure = false;
My current settings are:
$mail->isSMTP();
$mail->Host = "smtpout.secureserver.net";
$mail->Port = 80;
$mail->SMTPAuth = true;
//Enable SMTP debugging.
$mail->SMTPDebug = 4;
//Provide username and password
$mail->Username = "email#email.com";
$mail->Password = "password";
$mail->From = "email#email.com";
$mail->FromName = "From Name";
$mail->addAddress("email#email.com", "Name");
The email being used is the email created in GoDaddy which is Office 365 Email Essentials. Under Email & Office (Not Workspace Email or from cPanel). I'm using Economy Linux Hosting with cPanel package.
I'm new to GoDaddy so this problem is new to me. In some hosting providers like InMotion, I've never encountered this problem.
Godaddy made few changes the server relay setting. we don't need to separately mention the relay server settings anymore. following changes will works fine with PHPMailer.
$mail = new PHPMailer;
$mail->SMTPDebug = 0;
$mail->isSMTP();
$mail->Host = 'localhost';
$mail->Port = 25;
$mail->ssl = false;
$mail->authentication = false;
When I send a request to this, the request times out. This code has worked on another script in the same directory. I just logged into the gmail via browser to make sure all was good. The logged value of $mail->ErrorInfo is: SMTP connect() failed.
Any idea why this might work back in November but now throws an error when I copy it to another script?
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPDebug = 0;
$mail->CharSet = 'UTF-8';
$mail->Debugoutput = 'html';
$mail->Host = "smtp.gmail.com";
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Username = "xxxxxx#gmail.com";
$mail->Password = "xxxxxxxxxx";
$mail->setFrom('xxxxxxxxxxx#gmail.com', 'xxxxxxxx');
$mail->addReplyTo('xxxxx#gmail.com', 'xxxxxx');
$mail->addAddress($email, $name);
$mail->Subject = 'Your License Information';
$mail->Body = $message;
I tried another gmail account and I've tried using the app password Gmail gives you.
Since I had it working before in same directory with similar code, I knew it had to be something weird. I tried ping google.com which didn't work and got me thinking about outbound traffic. Then I did ping 24.156.131.93 which is Google's IP (cutting out the domain resolver) and that worked, so I changed my nameservers in resolv.conf to Google's 8.8.8.8 and it now works. So basically, my host has some issues with their nameservers they provided, and the error wasn't just for SMTP but outgoing traffic is a whole.
I have a form in my web site. When user enters data it should reach to my gmail id. I tried many things but it is not working.
http://pastebin.com/xABBduyB
This is the settings in php.ini
SMTP = smtp.gmail.com
sendmail_from = myname#gmail.com
SMTP_PORT = 465
Any help would be appreciated.
PHP's mail function works only with standard SMTP, but to access the Gmail server, you need to use SMTP over SSL. You can find an example of how to do this over here.
The simplest solution for you could be to use phpmailer library
This is the sample googled code to do that:
$mail->Mailer = "smtp";
$mail->Host = "ssl://smtp.gmail.com";
$mail->Port = 465;
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->Username = "username#gmail.com"; // SMTP username
$mail->Password = "password"; // SMTP password