Reputation: 311
Im using PHPMailer to connect to Gmails MX server, gmail-smtp-in.l.google.com
, on port 465
. This errors out Failed to connect to server: Connection timed out (110)
After reading online, I just had a chat with my host who successfully ran a traceroute to gmail-smtp-in.l.google.com
on port 25
and I was assured that connections were not being blocked by anything on the host side.
Do I need to set up anything in my gmail account? I am able to connect to other domains via SMTP.
I can ALSO connect to smtp.gmail.com
on 465
, but there the following command does not seem to work right
RCPT TO: <[email protected]>
gives me a 250
ok.
EDIT: and im using dns_get_record() to get MX record for domains.
this is part of the extended PHPMailer class that i wrote:
$this->IsSMTP();
$this->Host = $this->data['smtp_host'];
$this->Mailer = "smtp";
$this->Timeout = 10;
$this->SMTPDebug = 2;
$this->SMTPAuth = true;
$this->Port = 465;
$this->Username = '[email protected]';
$this->Password = 'my_password';
$ret[] = $this->smtpConnect();
$ret[] = $this->smtp->mail('[email protected]');
$ret[] = $this->smtp->recipient('[email protected]');
$this->smtpClose();
the above on ssl://gmail-smtp-in.l.google.com:465 errors out with Connection timed out (110)
on ssl://smtp.gmail.com:465 says 250 Ok, where I should get no such user.
Upvotes: 1
Views: 3289
Reputation: 37770
It's not clear why you are doing this. If you are using gmail's MX, it means you're sending directly to a gmail user. Typically this will only be on port 25, but if you want encryption, just issue a STARTTLS after connecting. SSL on 465 and TLS on 587 are submission ports for outbound mail, so I'm not surprised you get an immediate 250 OK - you'd expect a 5.1.1 bounce later on. If you tried the same on the MX, I would expect it to fail up front.
Upvotes: 0