What is the SMTP server for Gmail?

Why is Gmail SMTP port 465 not working?

I am trying to send a message through gmail using the SMTP port 465.

I have tested my code on my server, and it works fine. But I need to test it on a different server, and I keep getting the following error:

1.1 Error: 530 5.2 urn:ietf:params:smtp-tmpt#smtp-5.4 (in reply to RCPT TO command) 5.3 Content-type: text/plain (in reply to END DATA command)

The funny thing is that I am able to send the exact same message through the SMTP port 587 (the default port for gmail), and it works fine. I have verified that I have the correct account enabled for that port. My code is as follows:

I can't for the life of me figure out what the problem is. Any ideas? As @Mick M's answer, I changed the port to 587 and it worked perfectly.

What is the SMTP server for Gmail?

You might think that this is a silly question, since the Gmail client is Google's and Gmail is the default email client for Google Chrome, which of course you already have installed.

But, yes, the Gmail client does actually talk to an SMTP server; and in this instance, it is not one of Google's. It is a mail server which is hosted by the Russian web hosting service Mail.ru.

If you're trying to send mail from your Google account using a non-Gmail client - like, say, Outlook Express on Windows XP, or Thunderbird on Linux - you need to contact the server which handles Gmail in order to configure it to use that server to send mail. Why are you talking about email servers and clients? Are you the guy who was telling me that he was tired of all these idiots who make assumptions that their opinions are worth listening to? Well, then don't make any assumptions, just go to the source of the problem - the original author of the script, Mail.ru, and see if you can find a resolution. (They should be happy to accept some suggestions.)

It's not your place to decide what is appropriate or inappropriate, especially if you know you'll get flamed for it. I suggest you start reading the archives here. That's not a particularly accurate statement. It's not your place to decide what is appropriate or inappropriate, and even if you get flamed for it, that doesn't mean you should go around making assumptions about people.

No, but I also don't mean to imply that I think your script is inappropriate. I just don't think it's a good idea to write a tool which has the potential to cause problems for people.

If you can come up with a reasonable solution to the problem at hand, which includes making the changes you propose, then you should be able to get the required cooperation from the people you need to. I've made no assumptions about what you think of me. I've assumed that we have mutual respect for each other. I didn't assume that I know better than you what is appropriate.

How do I setup my SMTP server to send emails?

You may need to follow this, this and this (note, they're outdated and the SMTP part is still not done correctly, but if you'd be interested in how to properly configure one, then follow the last link). However, I want to provide a list of other things that would be useful to know/do at the same time, depending on how much traffic the server is sending.

Configure a catch-all mail relay for your domain name. Use this mail address for every message that doesn't resolve to your domain name and is delivered.

Configure a mail redirect for a certain domain (for example: sub.com to your website's contact form) so you don't waste bandwidth for messages sent to that domain name.

Use Mailinator to send email test mails from some other email that will bounce without going through your mail server. This is useful for testing your email delivery server.

Consider using an external provider (Gmail, etc.) instead of a self-hosted mail service (Exim or Postfix in this case), so as to not host and maintain an SMTP server.

Related Answers

How does the Simple Mail Transfer Protocol work?

It is a request-reply protocol used for electro...

What is Simple Mail Transfer Protocol and how does it work?

Simple Mail Transfer Protocol (SMTP) is a well-...

What Does SMTP mean?

I have to send email to a mobile user from my application. Is...