Click to See Complete Forum and Search --> : question about /etc/hosts debian


nephish
07-31-2006, 12:59 PM
hello there,
i am trying to get an email script to work in python.
the emails only fail going to certain providers.
when i look at the headers, it shows my domain as being localhost.localdomain.

in my /etc/hosts file i have this line
127.0.0.1 localhost.localdomain localhost PivServer

when i log into a terminal, it gives me username@PivServer

my question is, how do i get the mail in python to look like its being sent out from my domain name.

actually, the domain name of the web address is different than the host name on the machine. Do they need to match? The server is on an internal network with port 25, and 80, and 110 forwarded to it thru a cisco router.

any help would be ..... um.... helpful
thanks

IsaacKuo
07-31-2006, 04:12 PM
This looks to me more like a Python programming question, or an e-mail setup question, than a Debian question. I don't know how e-mail works in Python, so I can't help you there...

In any case, /etc/hosts doesn't have anything to do with e-mail configuration, AFAIK.

nephish
07-31-2006, 04:27 PM
right i have found that out so far. The reason i am posting this here is that my script does not check what hostname i am using. That would be something that the os passes to it. So i am basically wondering how to properly set a host name in debian. Or possibly, does anyone know if smtp filters require that your hostname = your domain name. Will they filter localhost.localdomain ?

thanks

IsaacKuo
07-31-2006, 04:38 PM
In Debian, you can set the computer's host name by editing the contents of /etc/hostname. However, this has nothing to do with e-mail configuration.

You can also modify some hostnames in /etc/hosts, but that also has nothing to do with e-mail configuration.

Here's the first link I found with a Google search of "python e-mail examples":

http://www.thinkspot.net/sheila/article.php?story=20040822174141155

It explains a couple ways to send e-mail with Python. Unless you're running your own mail server, you probably want to use the SMTP method. You can specify the "from" e-mail address as well as the "to" e-mail address.

nephish
07-31-2006, 05:16 PM
ok thanks for the link, in a nutshell, thats how i am doing it, and it works for most providers, just not others. eeek.

thanks much

nephish
08-01-2006, 01:56 PM
ok, little update. debian has an onboard utility to set the host name
> host = hostname.hostname.com (or whatever)
btw - something else seems to be the prob with me python script.
thanks