469,343 Members | 5,380 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,343 developers. It's quick & easy.

what is the 'host' for SMTP?

If I want to write a cgi script that reads the contents of an HTML form
and emails it to me, what would I use as the host parameter for my SMTP
instance? The example in the docs is 'localhost', but I don't know what
that means or refers to. I imagine I would have to use something that
was tied to me specifically, but tied to what? My computer? My email
address?
May 3 '06 #1
6 1923
On Tue, 02 May 2006 22:12:31 -0400, John Salerno wrote:
If I want to write a cgi script that reads the contents of an HTML form
and emails it to me, what would I use as the host parameter for my SMTP
instance?
Take a look at your email client. Find where it specifies the server for
outgoing mail. Use whatever it says there.

For example, I am a customer of blarg.net; I am therefore permitted to use
mail.blarg.net, which has a mail server running on it. If your ISP is
example.com, you probably will be using one of these:

mail.example.com
smtp.example.com

But it really could be anything:

norwegianblue.example.com
lovelyplumage.example.com

The example in the docs is 'localhost', but I don't know what
that means or refers to.
"localhost" is a standard UNIX/Linux alias for "my computer's address".
It will be bound to 127.0.0.1, which is a special, magic address that
can stand in for your computer's actual address.

(Thus the old joke about "hey, try to hack my firewall! Here's the
address: 127.0.0.1

If someone runs an attack script against that address, they are attacking
their own computer.)

If you have an SMTP server running on your computer, then you could use
"localhost" and it will work. Otherwise, not.

I imagine I would have to use something that
was tied to me specifically, but tied to what? My computer? My email
address?


SMTP is a protocol. You can talk SMTP to any computer that has an SMTP
server running. The standard port number for SMTP is port 25.

These days, most SMTP servers won't just let anyone use them to send email
just anywhere; an SMTP server configured to allow that is called an "open
relay" and spammers love to find them.

If you are using email, then as I said above, your email client should
have an SMTP server filled in already, and you are already using it every
time you send email. So I suggest you use that.
--
Steve R. Hastings "Vita est"
st***@hastings.org http://www.blarg.net/~steveha

May 3 '06 #2
raj
If you've a gmail account, you can set it as smtp.gmail.com.

May 3 '06 #3
Steve R. Hastings wrote:
Take a look at your email client. Find where it specifies the server for
outgoing mail. Use whatever it says there.

For example, I am a customer of blarg.net; I am therefore permitted to use
mail.blarg.net, which has a mail server running on it. If your ISP is
example.com, you probably will be using one of these:

mail.example.com
smtp.example.com


Thanks for all the information. Very helpful. But I'm still a little
confused, because it seems like that's not enough information. If all I
put in is, for example, smtp.gmail.com, how is that directed to my own
email address? Do I still need to include other, more specific (i.e.
personal) information elsewhere?
May 3 '06 #4
On Wed, 03 May 2006 16:10:16 +0000, John Salerno wrote:
If all I
put in is, for example, smtp.gmail.com, how is that directed to my own
email address?


The address of the SMTP server does not specify where the email will go.
SMTP is a protocol, and when you are talking SMTP to the server, part of
what the conversation includes will be to whom you wish to send the email.

Please Google for information on SMTP. You can also start here:

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

--
Steve R. Hastings "Vita est"
st***@hastings.org http://www.blarg.net/~steveha

May 3 '06 #5
Steve R. Hastings wrote:
On Wed, 03 May 2006 16:10:16 +0000, John Salerno wrote:
If all I
put in is, for example, smtp.gmail.com, how is that directed to my own
email address?


The address of the SMTP server does not specify where the email will go.
SMTP is a protocol, and when you are talking SMTP to the server, part of
what the conversation includes will be to whom you wish to send the email.

Please Google for information on SMTP. You can also start here:

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


Thanks, I'll give it a look.
May 3 '06 #6
Uh, I don't sent to list :P

---------- Forwarded message ----------
From: Marco Carvalho <ma************@gmail.com>
Date: May 4, 2006 12:45 AM
Subject: Re: what is the 'host' for SMTP?
To: John Salerno <jo******@nospamgmail.com>
On 5/3/06, John Salerno <jo******@nospamgmail.com> wrote:
Steve R. Hastings wrote:

Thanks for all the information. Very helpful. But I'm still a little
confused, because it seems like that's not enough information. If all I
put in is, for example, smtp.gmail.com, how is that directed to my own
email address? Do I still need to include other, more specific (i.e.
personal) information elsewhere?


You need a little more than a smtp server address to send an e-mail.

If you are using smtplib:

import smtplib
sender = "yo********@gmail.com"
to = "de***************@example.com"
message = "blablabla"
smtplogin = "your_login_on_gmail"
smtppasswd = "your_password_on_gmail"
smtpserver = "smtp.gmail.com"

smtp = smtplib.SMTP(smtpserver)
smtp.login(smtplogin,smtppasswd)
smtp.sendmail(sender, to, message)
smtp.quit()

I don't put the correct construction of the message's headers and
body, it's another story :-)

--
Marco Carvalho (macs) | marcoacarvalho(a)gmail.com
http://arrakis.no-ip.info | http://cdd.debian-br.org
Maceio - Alagoas - Brazil
Debian GNU/Linux unstable (Sid)
GNU-PG ID:08D82127 - Linux Registered User #141545
Notícias Semanais do Debian em Português: http://www.debian.org/News/weekly
Alertas de Segurança Debian (DSA): http://www.debian.org/security
--
Marco Carvalho (macs) | marcoacarvalho(a)gmail.com
http://arrakis.no-ip.info | http://cdd.debian-br.org
Maceio - Alagoas - Brazil
Debian GNU/Linux unstable (Sid)
GNU-PG ID:08D82127 - Linux Registered User #141545
Notícias Semanais do Debian em Português: http://www.debian.org/News/weekly
Alertas de Segurança Debian (DSA): http://www.debian.org/security
May 4 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Colin Kingston | last post: by
11 posts views Thread by justsome_newbie | last post: by
3 posts views Thread by itarunachalam | last post: by
3 posts views Thread by nickyeng | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.