PHP on GoDaddy Linux Shared trying to send through GMAIL SMTP

我的梦境 提交于 2019-11-27 02:09:44
Charles

As discussed previously, GoDaddy has been known to block outgoing SSL SMTP connections in favor of forcing you to use their own outgoing mail server.

This is pretty much the tip of the iceberg, with regard to the immense suckitude of GoDaddy as a company, registrar and web host. Ditch'em.

I had the same problem, and after going through different sites, I found this one and it actually worked!

GoDaddy does allow to send emails using Gmail as your SMTP, just need to get rid of the smtp.gmail.com and use their Host instead. This is my setup:

$mail = new PHPMailer();
$mail->isSMTP();
$mail->Host = "relay-hosting.secureserver.net";
$mail->Username = "your-account@gmail.com";
$mail->Password = "yourpassword";
// ...
// send from, send to, body, etc...

Reference (see first two posts) http://support.godaddy.com/groups/web-hosting/forum/topic/phpmailer-with-godaddy-smtp-email-server-script-working/

Daniel Ramirez

I finally fixed this putting a comment on the //$mail->isSMTP(); line. After that my Gmail account started working fine in Godaddy.

require 'PHPMailer/class.phpmailer.php';
require 'PHPMailer/PHPMailerAutoload.php';


$mail = new PHPMailer;


 $name = $_POST['name'];
    $email = $_POST['email'];
    $message = $_POST['message'];
    $subject = 'Your subject';

    $body = "From: $name\n E-Mail: $email\n Comments:\n $message";


//$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'xxxxxxxxxxxx@gmail.com';
$mail->Password = 'xxxxxxxxx';
$mail->SMTPSecure = 'tls';
$mail->Port =587;
Wang'l Pakhrin

Use localhost as the host on your hosting goDaddy server. Using the following ports 25,465,587. Settings for GoDaddy:

Answer relates to this link:PHPMailer GoDaddy Server SMTP Connection Refused by @Nate Bryam

 $this->mail->Host = 'localhost';  
    //$this->mail->SMTPAuth = true;                               
    //$this->mail->Username = 'xxx@gmail.com';            
    //$this->mail->Password = 'xxx';                      
    //$this->mail->SMTPSecure = 'ssl';                           
    //$this->mail->Port = 465;//25;//587; 

There is no need for SMTP Auth.It works perfect!

Unfortunately you can't even use an outbound mail service like DYNDNS with GoDaddy, they only allow you to use their relay server. Limiting.

george

The only option they have is to use the domain and use their e-mail service to send mail.

require_once('PHPMailerAutoload.php');

                    $mail = new PHPMailer();
                    $mail->isSMTP();
                    $mail->Host = "relay-hosting.secureserver.net";
                    $mail->Username = 'chandana@gmail.com';
                    $mail->Password = 'fwxnorhqttkxydr';
                    $mail->SetFrom($email);
                    $mail->Subject = 'enquiry from YnRack site';
                    $mail->Body = 'enquiry from YnRack site' . $message . '"From: \"' . $name . $email;
                    $mail->IsHTML(true);
                    $mail->AddAddress('chandana@gmail.com');
                    $mail->Send();

I'm not supporting Godaddy, because they generally sucks, but this working for me. They might have updated there systems.

$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'tls'; // secure transfer enabled REQUIRED for GMail
$mail->Host = "smtp.gmail.com";

$mail->Port = 587; // or 587 or 465
$mail->IsHTML(true);
$mail->Username = "stuff@gmail.com";
$mail->Password = "password";
$mail->setFrom('gmail_account@gmail.com', 'Someone's name');
$mail->Subject = $subject;
$mail->Body = $body;
$mail->AddAddress("gmail_account@gmail.com");
    if (!$mail->send()) {
        echo "Mailer Error: " . $mail->ErrorInfo;
        return false;
    } else {
        return true; 
    }
}

Oh I also want to everybody, I don't care about OOP!!!

you can use your gmail and have Godaddy enable Remote Mail Exchanger in Cpanel. You have to ask them do it because you do not have access to it in cpanel

Kuldeep Singh

Here is some information: http://aravindisonline.blogspot.in/2012/01/phpmailer-with-godaddy-smtp-email.html

This works for me:

$mail->Host = "relay-hosting.secureserver.net";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->SMTPSecure = 'tsl';
$mail->Port = 25;
//Whether to use SMTP authentication
$mail->SMTPAuth = false;

Is more simple. strangely you need comment line "// $mail->IsSMTP();". Yes, ok, its SMTP, but if you enable this line, you can't send mail. ...don't need more configuration. Only this comment line.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!