Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Email Server. [SOLVED]
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
justincataldo
Guru
Guru


Joined: 15 Jun 2005
Posts: 376
Location: Australia

PostPosted: Mon Jul 04, 2005 12:26 am    Post subject: Email Server. [SOLVED] Reply with quote

I'm pretty new to the whole Gentoo thing, and what I'd really like to know is the easiest way to set up email on my Gentoo server.

I've got a DSL connection, with a dynamic IP address. Using dyndns.org I have assigned a name to the IP. (me.dyndns.org for example).

I'd like to be able to use a mail client (probably thunderbird) to retrieve the email from my server using IMAP. From my server I want to be able to send email from the command line (eg: mail -s name@me.dyndns.org) or something.

Given this, I have been messing around with sendmail and mail and dovecot and different mtu's and a heap of different configurations, but I've not had much success and I'm rather confused about what I need to do really...

So given the information I've provided, what would be the easier way to set this up? I'm a little confused on exactly what I need to do. Like which things do I need? I gather than I need a mail transfer agent (mta), and a few other things, but I don't really understand how everything is intergrated.

I've heard about people using an IMAP setup using Dovecot and Courier. Most people swear that it is easier to configure than Sendmail. But they are all just and crazy each other to someone who is new to setting up email. :roll:

So what are some of the configurations people have running? Which mtu/mta/clients do you have running in conjuction and how did you set them up? I want to be able to send and receive mail externally (over the internet, not just internally).


Last edited by justincataldo on Tue Aug 09, 2005 11:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
splooge
l33t
l33t


Joined: 30 Aug 2002
Posts: 636

PostPosted: Mon Jul 04, 2005 1:01 am    Post subject: Reply with quote

I posted this somewhere earlier:

emerge postfix

/etc/postfix/main.cf -- edit these variables to suit:

myhostname
mydomainname
myorigin
mydestination
mynetworks

and you're done.

I also add this to help fight spam (you don't have to):

smtpd_delay_reject = no
smtpd_hard_error_limit = 2
smtpd_helo_required = yes

smtpd_helo_restrictions =
permit_mynetworks,
reject_invalid_hostname,
reject_unknown_hostname,
reject_non_fqdn_hostname

smtpd_client_restrictions =
reject_unknown_client

smtpd_sender_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_non_fqdn_sender,
reject_unknown_sender_domain,
permit

smtpd_recipient_restrictions =
reject_unauth_pipelining,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
reject_rbl_client relays.ordb.org,
reject_rbl_client list.dsbl.org,
reject_rbl_client sbl-xbl.spamhaus.org,
permit


for imap:
emerge courier-imap

it's really that simple
_________________
http://get.a.clue.de
Back to top
View user's profile Send private message
nevynxxx
Veteran
Veteran


Joined: 12 Nov 2003
Posts: 1123
Location: Manchester - UK

PostPosted: Mon Jul 04, 2005 9:56 am    Post subject: Reply with quote

Or go to www.gentoo.org then look in the doc's section. There are 3 ro 4 different tutorials depending on the exact config you want.
_________________
My Public Key

Wanted: Instructor in the art of Bowyery
Back to top
View user's profile Send private message
JeffBlair
Apprentice
Apprentice


Joined: 23 May 2003
Posts: 175
Location: USA, Lone star state

PostPosted: Mon Jul 04, 2005 12:28 pm    Post subject: Reply with quote

Take a look here. This sounds like what you want. It will download your mail from your ISP, and store it on your PC. It even has a howto for webmail.
Back to top
View user's profile Send private message
justincataldo
Guru
Guru


Joined: 15 Jun 2005
Posts: 376
Location: Australia

PostPosted: Mon Jul 04, 2005 2:11 pm    Post subject: Reply with quote

Well I've done all the splooge's post described. Now what do I do from there? How can I test it?
Back to top
View user's profile Send private message
splooge
l33t
l33t


Joined: 30 Aug 2002
Posts: 636

PostPosted: Mon Jul 04, 2005 5:21 pm    Post subject: Reply with quote

you can test it out using telnet:

#emerge netkit-telnetd
#telnet localhost 25

Make sure you get the 220 response. If not, you probably need to run newaliases and restart postfix.

If it works, try sending an e-mail to yourname@yourhost.dyndns.org. It should end up in the /home/yourname/.maildir/new folder, at which point courier can pick it up and serve it to you via imap or pop3.
_________________
http://get.a.clue.de
Back to top
View user's profile Send private message
justincataldo
Guru
Guru


Joined: 15 Jun 2005
Posts: 376
Location: Australia

PostPosted: Tue Jul 05, 2005 12:11 am    Post subject: Reply with quote

Here's what I've done so far:

myhostname = yang.jc.gotdns.org
mydomain = jc.gotdns.org
myorigin = $myhostname
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mynetworks_style = subnet

Then I ran postfix and tried to telnet to it:
Code:

yang ~ # /etc/init.d/postfix start
 * Starting postfix ...                                                                                               [ ok ]
yang ~ # telnet localhost 25
Trying 127.0.0.1...
Connected to yang.
Escape character is '^]'.

So it looks like that is working...

I then ran courier.

Code:

yang mail # /etc/init.d/courier-imapd start
 * Starting courier-authlib: authdaemond ...                                                                       [ ok ]
 * Starting courier-imapd ...                                                                                         [ ok ]
yang mail #


I emerged mutt ('cause I figured it would be best to get things working with mutt before I complicate things with Thunderbird), then tried to email justin@yang.jc.gotdns.org from the mutt (internally) and also from work (externally), but when I checked the justin account's mutt mailbox it is empty. What else do I need to do? Is my configuration correct? Do I need to edit the /etc/mail/aliases file? When I go into mutt it says /home/justin/.maildir/: no such file or directory (errno = 2). Is that a bad thing?

Do I need to do anything special with my modem configuration? Like forward any ports specifically?
Back to top
View user's profile Send private message
splooge
l33t
l33t


Joined: 30 Aug 2002
Posts: 636

PostPosted: Tue Jul 05, 2005 4:52 am    Post subject: Reply with quote

You need to run newaliases and restart postfix. You didn't receive a 220 respons from your e-mail server. This typically indicates postfix didn't find it's alias database.

It should look like this:

#telnet localhost 25
Trying 127.0.0.1...
Connected to fw.pwned.com.
Escape character is '^]'.
220 mail.pwned.com ESMTP Postfix

.maildir will get created automagically when postfix receives its first e-mail.
_________________
http://get.a.clue.de
Back to top
View user's profile Send private message
splooge
l33t
l33t


Joined: 30 Aug 2002
Posts: 636

PostPosted: Tue Jul 05, 2005 5:02 am    Post subject: Reply with quote

justincataldo wrote:
Do I need to do anything special with my modem configuration? Like forward any ports specifically?


If you're using a dsl/cable router, yes, you'll need to forward port 25 into your server. If your linux box is connected directly to the net you should be fine.
_________________
http://get.a.clue.de
Back to top
View user's profile Send private message
justincataldo
Guru
Guru


Joined: 15 Jun 2005
Posts: 376
Location: Australia

PostPosted: Tue Jul 05, 2005 10:13 am    Post subject: Reply with quote

Ok, well I'm not quite there yet, but I'm close...

Using mutt, I can send and recieve mail internally. I can recieve mail from places on the internet (gmail etc), but can't send mail out to the internet. If I look at the mail queue using Webmin I can see it sitting there, but not being sent. How do I fix this?

And once that is fixed, how do I configure Thunderbird?
Back to top
View user's profile Send private message
splooge
l33t
l33t


Joined: 30 Aug 2002
Posts: 636

PostPosted: Tue Jul 05, 2005 11:34 pm    Post subject: Reply with quote

Your ISP might be blocking port 25 outbound. See if you can connect to someone elses smtp server.

telnet mail.pwned.com 25

And see if you get a connection
_________________
http://get.a.clue.de
Back to top
View user's profile Send private message
justincataldo
Guru
Guru


Joined: 15 Jun 2005
Posts: 376
Location: Australia

PostPosted: Wed Jul 06, 2005 5:06 am    Post subject: Reply with quote

I tried to telnet to your server from windows, but it said "Could not open connection to the host, on port 25: Connection failed".

From my server:
Code:

justin@yang ~ $ telnet mail.pwned.com 25
Trying 69.175.14.102...
telnet: Unable to connect to remote host: No route to host


I am forwarding port 25 on my DSL modem to port 25 on my server. Is there something else I need to do?

My ISP is Telstra Bigpond (in Australia).
Back to top
View user's profile Send private message
rex123
Apprentice
Apprentice


Joined: 21 Apr 2004
Posts: 272

PostPosted: Wed Jul 06, 2005 10:27 am    Post subject: Reply with quote

A little bit of gratuitous smtp background:

If you want to send mail to someone, it has to end up at their mail server, which is defined in DNS with an mx record. The steps are these:
1) look up the mx record for the domain in dns (take the one with the lowest priority number first)
2) connect to the mail exchanger (mx), port 25
3) send the e-mail using the smtp protocol

What this looks like when you do it manually (sending to [anyone]@microsoft.com):

Code:
 $ dig mx microsoft.com
[...]
;; QUESTION SECTION:
;microsoft.com.                 IN      MX
;; ANSWER SECTION:
microsoft.com.          1926    IN      MX      10 mailc.microsoft.com.
[...]
;; ADDITIONAL SECTION:
maila.microsoft.com.    3238    IN      A       131.107.3.124
[...]
--- We now know that the server to try is 131.107.3.124
$ telnet 131.107.3.124 25
Trying 131.107.3.124...
Connected to 131.107.3.124.
Escape character is '^]'.
220 IGR-IMC-02.redmond.corp.microsoft.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at  Wed, 6 Jul 2005 02:57:11 -0700
quit [I don't want to actually spam bill]
221 2.0.0 IGR-IMC-02.redmond.corp.microsoft.com Service closing transmission channel
Connection closed by foreign host.


2 extra points:
1) All that work is normally done by your own MTA (mail transfer agent), not by you.
2) sometimes you can't connect directly to the MX of the recipient, but you relay via another MX, which is then called a smarthost (I have no idea why; they aren't very smart)

You can forget all that if you like, but I think it's useful to know if you are interested in running your own mail server successfully.

Back to your question. Most likely bigpond is blocking port 25 to any hosts other than their own smarthosts. This is to prevent spam, and is sensible. So you need to tell postfix to send all mail to the bigpond smarthost (don't ask me what it is - their web site will tell you), which will relay it because it trusts you (because you are their customer). I don't know how to do that using postfix, but it can't be all that hard.

If you use Thunderbird, you can send mail directly via the smarthost (set it up as the SMTP server) and not via your local server at all, which might make your life easier. Mutt requires a local MTA because it doesn't know how to do SMTP, but Thunderbird is modelled on Windows-style apps, which don't expect a local MTA.

Your mail server is working fine for incoming SMTP (I just tried it), but you might need to check where it delivers to, and then check that your IMAP server is using the same location.
Back to top
View user's profile Send private message
splooge
l33t
l33t


Joined: 30 Aug 2002
Posts: 636

PostPosted: Wed Jul 06, 2005 2:40 pm    Post subject: Reply with quote

justincataldo wrote:
I tried to telnet to your server from windows, but it said "Could not open connection to the host, on port 25: Connection failed".

From my server:
Code:

justin@yang ~ $ telnet mail.pwned.com 25
Trying 69.175.14.102...
telnet: Unable to connect to remote host: No route to host


I am forwarding port 25 on my DSL modem to port 25 on my server. Is there something else I need to do?

My ISP is Telstra Bigpond (in Australia).


Hmm, try a different mail server. "No route to host" isn't indicative of a blocked outbound port. I'm looking for something more along the lines of a "Connection refused." Try:

telnet mail.homestore.com 25

Forwarding port 25 on your dsl router is what gets the mail in. It has nothing to do with the mail going out. If outbound 25 is indeed blocked, you'll need to adjust the relayhost setting in main.cf accordingly to use your isp's mta.
_________________
http://get.a.clue.de
Back to top
View user's profile Send private message
justincataldo
Guru
Guru


Joined: 15 Jun 2005
Posts: 376
Location: Australia

PostPosted: Wed Jul 06, 2005 3:15 pm    Post subject: Reply with quote

Same thing on Windows "Could not open connection to the host, on port 25: Connection failed").

From Linux:
Code:

justin@yang ~ $ telnet mail.homestore.com 25
Trying 209.74.97.215...

telnet: Unable to connect to remote host: Connection timed out


Although, I did try the following and it worked:
Code:

yang ~ # telnet mail.bigpond.com 25
Trying 144.140.80.10...
Connected to mail.bigpond.com.
Escape character is '^]'.
220 omta03ps.mx.bigpond.com ESMTP server ready Wed, 6 Jul 2005 15:13:12 +0000
Back to top
View user's profile Send private message
DaveArb
Guru
Guru


Joined: 29 Apr 2004
Posts: 510
Location: Texas, USA

PostPosted: Wed Jul 06, 2005 3:47 pm    Post subject: Reply with quote

Looking on Google, Telstra started port 25 blocking in April, 2004. You can of course hit their mailserver on port 25, otherwise any email at all would be very difficult. Smarthosting through their mailerver, or convincing them to unblock your port 25 (should be unlikely) are your options as I see them.

Dave
Back to top
View user's profile Send private message
rex123
Apprentice
Apprentice


Joined: 21 Apr 2004
Posts: 272

PostPosted: Wed Jul 06, 2005 3:51 pm    Post subject: Reply with quote

Bigpond is clearly blocking port 25 to arbitrary hosts. A quick Google for 'telstra bigpond "port 25" blocked' confirms this.

So set up postfix to use mail.bigpond.com as the smarthost (or relayhost), and you will be fine. Here's the info you need: http://bigpond.custhelp.com/cgi-bin/bigpond.cfg/php/enduser/std_adp.php?p_admin=1&p_faqid=5564&p_created=1081218123
Back to top
View user's profile Send private message
justincataldo
Guru
Guru


Joined: 15 Jun 2005
Posts: 376
Location: Australia

PostPosted: Thu Jul 07, 2005 1:15 am    Post subject: Reply with quote

relayhost = mail-hub.bigpond.net.au seems to do the trick.

I can now send and recieve email internally and externally. However, when I send mail to an external address it says it came from justin@yang.jc.gotdns.org but if anyone tries to reply it's not going to work. The reply address needs to be justin@jc.gotdns.org. I don't understand why this is happening. In my main.cf file I have myorigin = $mydomain. But if I go cat /etc/dnsdomainname it spits out jc.gotdns.org. So where the hell is it getting yang.jc.gotdns.org from?

How do I configure thunderbird? At the moment I have got:

Server Type: IMAP Mail Server
Server Name: yang.jc.gotdns.org
Port: 143
Username: justin


When I start it up it asks me for the password for justin@yang.jc.gotdns.org. But when I put it in it says Login to server yang.jc.gotdns.org failed. Is port 143 the correct port? Do I need to change some IMAP configuration somewhere?
Back to top
View user's profile Send private message
rex123
Apprentice
Apprentice


Joined: 21 Apr 2004
Posts: 272

PostPosted: Thu Jul 07, 2005 8:31 am    Post subject: Reply with quote

justincataldo wrote:
relayhost = mail-hub.bigpond.net.au seems to do the trick.

I can now send and recieve email internally and externally. However, when I send mail to an external address it says it came from justin@yang.jc.gotdns.org but if anyone tries to reply it's not going to work. The reply address needs to be justin@jc.gotdns.org. I don't understand why this is happening. In my main.cf file I have myorigin = $mydomain. But if I go cat /etc/dnsdomainname it spits out jc.gotdns.org. So where the hell is it getting yang.jc.gotdns.org from?


That's your hostname. Your local domain is jc.gotdns.org, and the computer you are using has yang as its unqualified hostname (which is why your bash prompt starts with "yang").

I'm assuming you are using mutt, which would naturally use your username@your hostname as the from address. But you can configure mutt with something like
Code:
set from="Justin <justin@jc.gotdns.org>"

in .muttrc

Or use Thunderbird to send mail, by telling it to use the bigpond smtp server. Thunderbird will use whatever you tell it as the from address.

justincataldo wrote:

How do I configure thunderbird? At the moment I have got:

Server Type: IMAP Mail Server
Server Name: yang.jc.gotdns.org
Port: 143
Username: justin


When I start it up it asks me for the password for justin@yang.jc.gotdns.org. But when I put it in it says Login to server yang.jc.gotdns.org failed. Is port 143 the correct port? Do I need to change some IMAP configuration somewhere?


Sounds like you are connecting to your IMAP server, but the password isn't working. If you're using your shell logon password, it will only work if your IMAP server is configured to use that. So it's probably an IMAP config question... and I don't know what IMAP server you are using. But whatever it is, look for its logs. It should be logging to /var/log/something. Even courier, which I think is terrible at giving useful logging information, should be able to tell you something about a failed logon.
Back to top
View user's profile Send private message
katsiki
Apprentice
Apprentice


Joined: 14 Jun 2005
Posts: 233
Location: Pasadena, CA (USA)

PostPosted: Thu Jul 07, 2005 10:20 am    Post subject: Reply with quote

Dear justincataldo:

I would skip installing an MTA until you get more familiar with the other parts of your system, since it sounds like you have a third-party account that provides SMTP. Give a try to using ssmtp, which is included in the default 2005.0 stage 3 installation. It will enable your daemons and your human users to send mail through your third-party SMTP server. To setup for outgoing mail, just configure /etc/ssmtp/ssmtp.conf for your third-party SMTP settings. Very simple, very secure, and you can postpone getting an MX record, DNS, etc.

It is helpful to emerge mutt into the mix. Traditionally daemon config files are designed to use a command line such as,
Code:
mail -s

to communicate status and logs. However the Gentoo mailx package looks stale; and emerging it on my system gave compiler errors. Like mail, mutt can be invoked from the command line. Plus humans can use it to send mail and receive POP and IMAP too.

Try this Google:
Code:
site:forums.gentoo.org ssmtp
Back to top
View user's profile Send private message
rex123
Apprentice
Apprentice


Joined: 21 Apr 2004
Posts: 272

PostPosted: Thu Jul 07, 2005 12:07 pm    Post subject: Reply with quote

katsiki wrote:
Dear justincataldo:

I would skip installing an MTA until you get more familiar with the other parts of your system, since it sounds like you have a third-party account that provides SMTP [...][/code]


Yes, but he's running a mail server for incoming mail (to hisname@hisdynadns.domain). So a proper MTA is required. For sending mail, the local MTA can be missed out altogether by the likes of Thunderbird, which I've been recommending, but mutt (and the like) need to use the local MTA, so it might as well be able to send as well as receive.
Back to top
View user's profile Send private message
justincataldo
Guru
Guru


Joined: 15 Jun 2005
Posts: 376
Location: Australia

PostPosted: Thu Jul 07, 2005 1:34 pm    Post subject: Reply with quote

Awesome! Adding set from="Justin <justin@jc.mydomain.org>" to Muttrc works. So now Mutt is completely set up. To send and receive. :smile:

Thunderbird is not playing the game though. I've told it to connect to yang.jc.gotdns.org on port 443 (I know it works 'cause I can telnet to it) and I told it to send outgoing mail to mail-hub.bigpond.net.au on port 25 (which we all know works 'cause we can telnet to it too). Yet, Thunderbird says to me "log in to yang.jc.gotdns.org failed".


Last edited by justincataldo on Sun Mar 11, 2007 1:58 pm; edited 1 time in total
Back to top
View user's profile Send private message
rex123
Apprentice
Apprentice


Joined: 21 Apr 2004
Posts: 272

PostPosted: Thu Jul 07, 2005 2:06 pm    Post subject: Reply with quote

Port 443 is accepting connections, but the logon is failing. Bear in mind that mutt isn't fetching mail via IMAP, so the fact that mutt is working won't help with thunderbird's IMAP connection.
I would guess that your IMAP server configuration is wrong. Either that or you are entering the wrong password all the time. As I mentioned, the logs should help. If you want more info, you will probably need to say what IMAP server you are trying to run.
Back to top
View user's profile Send private message
splooge
l33t
l33t


Joined: 30 Aug 2002
Posts: 636

PostPosted: Thu Jul 07, 2005 7:16 pm    Post subject: Reply with quote

edit the myorigin line in /etc/postfix/main.cf to say jc.gotdns.org.
_________________
http://get.a.clue.de
Back to top
View user's profile Send private message
justincataldo
Guru
Guru


Joined: 15 Jun 2005
Posts: 376
Location: Australia

PostPosted: Thu Jul 07, 2005 10:44 pm    Post subject: Reply with quote

splooge wrote:
edit the myorigin line in /etc/postfix/main.cf to say jc.gotdns.org.
Alright. I've done this. But when I send email it still says the return address is justin@yang.jc.gotdns.org. The return address is only correct when I set it in the Muttrc file (justin@jc.gotdns.org).

I am using courier-imap.

Does anyone know what I need to configure in courier-imapd to allow Thunderbird to log in?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum