Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > what is the 'host' for SMTP?

Reply
Thread Tools

what is the 'host' for SMTP?

 
 
John Salerno
Guest
Posts: n/a
 
      05-03-2006
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?
 
Reply With Quote
 
 
 
 
Steve R. Hastings
Guest
Posts: n/a
 
      05-03-2006
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"
http://www.blarg.net/~steveha

 
Reply With Quote
 
 
 
 
raj
Guest
Posts: n/a
 
      05-03-2006
If you've a gmail account, you can set it as smtp.gmail.com.

 
Reply With Quote
 
Dennis Lee Bieber
Guest
Posts: n/a
 
      05-03-2006
On 2 May 2006 22:27:11 -0700, "raj" <> declaimed
the following in comp.lang.python:

> If you've a gmail account, you can set it as smtp.gmail.com.


He's mentioned having the mail sent from a CGI script, so the
"computer" would be the web server... I'd hope his hosting provider has
a mail server available (with luck even on the same server, so
"localhost" would work -- and configured to assume any email submitted
by itself is a valid user).
--
Wulfraed Dennis Lee Bieber KD6MOG

HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: web-)
HTTP://www.bestiaria.com/
 
Reply With Quote
 
John Salerno
Guest
Posts: n/a
 
      05-03-2006
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?
 
Reply With Quote
 
Steve R. Hastings
Guest
Posts: n/a
 
      05-03-2006
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"
http://www.blarg.net/~steveha

 
Reply With Quote
 
John Salerno
Guest
Posts: n/a
 
      05-03-2006
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.
 
Reply With Quote
 
Marco Carvalho
Guest
Posts: n/a
 
      05-04-2006
Uh, I don't sent to list

---------- Forwarded message ----------
From: Marco Carvalho <>
Date: May 4, 2006 12:45 AM
Subject: Re: what is the 'host' for SMTP?
To: John Salerno <>


On 5/3/06, John Salerno <> 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 = ""
to = ""
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57