Sign in to follow this  
v0dKA

What exactly is SMTP?

Recommended Posts

I'm trying to configure PHP to be able to send email using a script. The config file requests my SMTP. What exactly is SMTP? From searching, I see it's a protocol for sending email. That's great, but how do I know what mine is? After a bit more searching, I only widened my confusion - on a guide about configuring PHP, here's the example they gave about what you should put under the SMTP field (in the config file): SMTP = mail.yourisp.com sendmail_from = youremail@somewhere-or-other.com More research keeps bringing up the phrase "sendmail program". The FAQ is as big as a book and overly technical, and I am unfortunately a newb in the web development business. Besides, I'm not even sure if I need the sendmail program at all. Can anyone please explain how to figure out what my "SMTP" is?

Share this post


Link to post
Share on other sites
It's probably asking for your outgoing SMTP server. The ISP for whatever machine you're running the PHP script on should be able to tell you what the SMTP server name should be.

Share this post


Link to post
Share on other sites
I don't consider myself an expert, but I'll tell you what I know. If you're familiar with FTP and how applications use ports, then this won't be too confusing. FTP uses port 21 for connections, and I think port 20 for data transfer (might be the other way around, I can't remember for sure). SMTP uses port 25. If you've used FTP, you know you connect to an FTP server. It's the same thing with SMTP. You have a mail server that holds messages received via SMTP, and it sends messages to other mail servers via SMTP. The SMTP it's asking you for is probably the server, like SiCrane said. Here's a wikipedia link:

http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol

Unfortunately, I've never tried to do this in PHP. If you can't get it working, you might try posting something about it in the Web Development forum under "Special Interests." You can safely bet money that someone on gamedev has done something like this before.

Share this post


Link to post
Share on other sites
Thanks for the help so far.

Is my outgoing SMTP server something like "smtp.mail.wowway.com" (which is what I think it is in my case)?

Couple more questions...
1. The SMTP server - is this something my computer connects to every time I send email? Even from GMail or Hotmail?
2. Is there anything stopping a random person from the opposite side of the earth to fill in my SMTP server and email in his PHP config file and send mail in his PHP scripts using my email?
3. My PHP is set up to run as an Apache module. Is Apache involved in any of this? Is there additional configuration I have to do for Apache?

Share this post


Link to post
Share on other sites
Quote:
1. The SMTP server - is this something my computer connects to every time I send email? Even from GMail or Hotmail?


If you're sending mail from your local machine. GMail and Hotmail are web-based, so they use their own SMTP servers (your email is posted to their web server, then their web server uses their own SMTP server to send out your mail).

Quote:
2. Is there anything stopping a random person from the opposite side of the earth to fill in my SMTP server and email in his PHP config file and send mail in his PHP scripts using my email?


If your SMTP server isn't secured, then its possible for someone to use it. This is how a lot of spammers send out their mail. Most ISPs password-protect their servers.

Quote:
3. My PHP is set up to run as an Apache module. Is Apache involved in any of this? Is there additional configuration I have to do for Apache?


I'm not familiar with Apache and PHP. When I work on projects using IIS, its a setting in our web project, not IIS. I would guess a PHP project in Apache would work the same way.

Share this post


Link to post
Share on other sites
I just tested it, and it works!... using my dad's email. My regular email is GMail; is there any way to use GMail for this? Do they keep their outgoing SMTP server secret/protected/unaccessible for these types of purposes?

Share this post


Link to post
Share on other sites
You probably won't be able to use gmail's SMTP server unless your server has an IP owned by google, which seems doubtful. However, the SMTP server of the whichever ISP allocated the IP that your server uses should work despite whatever domain name you use as the sender for the e-mails sent by your server.

Keep in mind that if your server gets compromised from the outside and starts sending spam the ISP may hold you responsible.

Share this post


Link to post
Share on other sites
To summarize a lot that was said above:

SMTP is an OSI presentation layer level plaintext protocol which is used to send outgoing email. It is grouped in with the rest of the TCP/IP protocol suite.

To test out the SMTP protocol by yourself, connect by telnet to your SMTP server's port 25 and then type in the commands manually.

SMTP setup is on a per-application basis.

There is no way to truly guarantee that someone will not attempt to spoof your email address. Viruses do it all the time.

However, a good SMTP server requires secure authentication to send out mail on your behalf. That way, if a counterfit message was sent on the behalf of your account, they would have to know your individual login credentials on the SMTP server. Otherwise, the message would have to sent by a different SMTP server, which automatically proves its illegitimacy.

When you use GMail or Hotmail, etc through their native web interfaces, then your computer does not directly contact the accompanying SMTP server, the web server does that for you automatically.

When you do this through a program like Microsoft Outlook, then yes, you can configure it to use a direct connection to an SMTP server.

Either way, you are well covered.

Share this post


Link to post
Share on other sites
From a quick google, it looks like GMail's SMTP server is SSL secured, so you can log in to it using your GMail login and then use it to send mail.

cheers
sam

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this