Postfix
Contents
Procedures
Start/stop/restart postfix
rcpostfix restart // SuSE
Start/stop/restart fetchmail
rcfetchmail restart // SuSE
Journal
20051016
- Running postfix programs on my SuSE machine are:
me@linux:~> ps -ef | grep postfix root 6872 1 0 21:15 ? 00:00:00 /usr/lib/postfix/master postfix 6887 6872 0 21:15 ? 00:00:00 qmgr -l -t fifo -u postfix 8043 6872 0 21:44 ? 00:00:00 pickup -l -t fifo -u
- Mail transfer can be configured easily using {Control Center|YaST2 modules|Network Services|Mail Transfer Agent}?
20051029
+-----+ +-----+ +------------+ +-----+ | MTA +-->--+ MDA +-->--+ Mail store +-->--+ MUA | +-----+ +-----+ +------------+ +-----+ MTA = Mail Transport Agent MDA = Mail Dispatch Agent MUA = Mail User Agent ([1])
- Aliased me for root mail in /etc/aliases
20051108
It is the fetchmail process which is responsible for retrieving my e-mail:
/usr/bin/fetchmail -d 600 -a -f /etc/fetchmailrc -L /var/log/fetchmail
Connecting to my providers mail server tells me I'm using the ESMTP protocol:
me@linux:~> telnet mail.myisp.nl 25 Trying 123.123.123.123... Connected to mail.myisp.nl. Escape character is '^]'. 220 smtp5.myisp.nl ESMTP Postfix
20051113
Fetchmail is delivering my e-mail to my unix-account (i.e. the file ~/mbox), accessible with mail (nail). How can I get it into mutt? Solution: specify in .muttrc: set spoolfile='/var/spool/mail/me'
There is a commented setting #home_mailbox = Maildir/ in my /etc/postfix/main.cf
E-mail info page with nice dataflow diagram
20051114
Added color index red default ~P to my .muttrc to get black letters on white background.
Command G says POP host is not defined.
Very verbose mutt 1.2 .muttrc example here. I'm using mutt version 1.5.9i though.
Seems like mutt is working ok. But postfix holds my sent messages in /var/spool/postfix/defer with an error message from my ISP mail host: 450 <me@linux.site>: Sender address rejected: Domain not found (in reply to RCPT TO command). Solution: when using mail, I have to specify -r from-addr to specify a valid e-mail address to be accepted by my ISP mail host. Now, how do I tell Mutt? By putting set from=... in ~/.muttrc.
20051117
+-----------+ +----------+
| fetchmail +---------<----+ INTERNET |
+---+-------+ +-----+----+
| |
-+---------------- |
/var&047;spool/mail/me ^
----+------------- |
v |
+---+--+ +-----+---+
| mutt +--------->---------+ postfix |
+---+--+ +-----+---+
v v
-+---- ---+--------------
~/Mail (mbox) /var&047;spool/postfix
------ ------------------
20051123
It seems that after I manually edit my /etc/postfix/main.cf to change myhostname it is being reset to its old value?
Another useful link: Mail server HOWTO - OpenSUSE
Mail sent by mutt is sent back as 'Undelivered Mail Returned to Sender' to 'me@myisp.nl'? This is probably from my local machine – not my provider – because I specified myhostname = myisp.nl in main.cf and I'm me...
This seems to be it: leave myhostname to be my machine, but specify myorigin to be my e-mail provider's domain.
20051126
+-----------+ +-----------+ +----------+
| LOCALHOST | | fetchmail +---------<----+ INTERNET |
+-----+-----+ +---+-------+ +-----+----+
| | |
| ------------+----- |
+---->-----/var&047;spool/mail/me ^
------------+----- |
v |
+---+--+ +-----+---+
| mutt +--------->---------+ postfix |
+---+--+ +-----+---+
v v
-+---- ---+--------------
~/Mail (mbox) /var&047;spool/postfix
------ ------------------
Why is mail normally stored in one folder? Shouldn't mail be stored per project? Let's take a look if mutt can provide the means. Maybe it's just like normal mail: you immediately get rid of the unwanted mail, archive the important mail and leave some mail for later perusal. Thus, I don't need that many folders for storing mail. With mutt, I can have any project have its own mailbox.
Another useful place for information is the mutt wiki.
20060221
When setting up another server via YaST, I receive this message:
To be able to deliver mail to your local MTA, the value of POSTFIX_LOCALDOMAINS in /etc/sysconfig/postfix will be set to "\$myhostname, localhost.\$mydomain, \$mydomain".
20060223
Again (see #20051114), the messages are in /var&047;spool/postfix/defer with error message: Host or domain name not found. Name service error for name=mail.foo.tv type=MX: Host not found, try again
Got error message from mutt when trying to send mail: ^: Permission denied (errno = 13). Removed ^ from Fcc and folder-hook . 'set record="^"' from muttrc, since the special meaning of ^ is available in mutt-1.5.10 and I'm using 1.5.9.
Google to the rescue: Sending mails to remote domains is not working. - HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials:.
All kinds of useful logs: /var/log/mail.err, /var/log/warn, /var/log/mail.info, /var/log/mail, /var/log/fetchmail. Fetchmail gives error message as well: fetchmail: couldn't find canonical DNS name of foo.nl (foo.nl).
Forum also pointed me to /etc/resolv.conf which is empty indeed on my new system, filled on my old.
The postfix site: Postfix Frequently Asked Questions: Mail stays queued with: Host not found, try again.
Solution: I hadn't setup my DNS. Start YaST, {Network Services | DNS and Hostname}.
20060503
Cron mail isn't delivered locally. Local mail is delivered to my ISP. This is probably caused by setting myorigin to my ISP.
20060509
Yes, commenting myorigin makes local mail coming to my local mailbox again.
mydomain = myisp.com myorigin = $mydomain relayhost = mail.myisp.com
20060513
But now Postfix refuses to sent local mail sent to my ISP, complaining '<me@myisp.nl>: unknown user: "me"'.
Must be because Postfix regards its own box as myisp.com, can't find 'me' and errors. So the settings above from mail-abuse.com only works for e-mail addresses other than myisp.com ...
It's in the manual: file:///usr/share/doc/packages/postfix/html/INSTALL.html. mydestination should not comprise mydomain.
mydomain = myisp.com myorigin = $mydomain relayhost = mail.myisp.com mydestination = $myhostname, localhost.$mydomain, localhost
20060527
Cron mail is still sent to (non-existing) me@myisp where it should be sent to me@localhost.
Starting from scratch. I want local mail delivered, and outgoing mail routed through myisp:
#myhostname = # Leave to default ($HOSTNAME) #mydomain = # Leave to default #myorigin = # Leave to default ($myhostname) mydestination = $myhostname, localhost.$mydomain, localhost relayhost = mail.myisp.nl
Postfix complains in /var/log/mail:
May 27 12:20:01 mybox postfix/sendmail[29586]: warning: My hostname mybox is
not a fully qualified name - set myhostname or mydomain in /etc/postfix/main.cf
#myhostname = # Leave to default ($HOSTNAME) mydomain = site #myorigin = # Leave to default ($myhostname) mydestination = $myhostname, localhost.$mydomain, localhost relayhost = mail.myisp.nl
I sent mail via mutt with set from = my@myisp.nl, but message remains in queue:
#> # Look into postfix queue
#> postqueue -p
-Queue ID- --Size-- ----Arrival Time---- -Sender/Recipient-------
7B09C1AAAA 408 Sat May 27 12:46:51 me@myhostname.site
(host smtp.myisp.nl[123.123.123.123] said: 450 <me@myhostname.site>: Sender address
rejected: Domain not found (in reply to RCPT TO command))
me@myisp.nl
#> # Delete queued message
#> postsuper -d 7B09C1AAAA
20060528
Postfix Address Rewriting: Generic mapping for outgoing SMTP mail
Test:
/usr/sbin/sendmail -bv me@myisp.country
now returns:
Reporting-MTA: dns; mybox.mydomain
X-Postfix-Queue-ID: 0CD5C15DA0
X-Postfix-Sender: rfc822; me@mybox.mydomain
Arrival-Date: Sun, 28 May 2006 10:05:37 +0200 (CEST)
Final-Recipient: rfc822; me@myisp.country
Action: deliverable
Status: 2.0.0
Diagnostic-Code: X-Postfix; delivery via smtp.myisp.country[123.123.123.123]: 250
Ok
So it works.
Is postfix revealing kind-of private information via X-Postfix-Sender?
It appears username is not revealed, but mybox.mydomain is...
20101010
Upgraded client to Ubuntu-10.04. To sent mail from client:
1. Create user mailbox file (as root):
cd /var/mail touch myname chown myname myname chmod 600 myname
2. Install or re-configure postfix (as root):
dpkg-reconfigure # Choose "Internet with smarthost"
And use the folling settings - after replacing DOMAIN, EMAIL, HOST, ISP, USER with current values:
$ cat /etc/postfix/main.cf ... mydomain = DOMAIN myhostname = HOST.DOMAIN myorigin = $mydomain alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases mydestination = $myhostname, localhost.$mydomain, localhost relay_domains = relayhost = mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all smtp_generic_maps = hash:/etc/postfix/generic transport_maps = hash:/etc/postfix/transport $ cat /etc/postfix/generic USER@DOMAIN EMAIL@ISP.COUNTRY USER EMAIL@ISP.COUNTRY $ cat /etc/postfix/transport # Internal delivery DOMAIN : .DOMAIN : # External delivery * smtp:[smtp.ISP.COUNTRY] $ cat /etc/mailname # Used by mutt HOST.DOMAIN
3. Create Postfix lookup tables (as root)
cd /etc/postfix postmap generic postmap transport
4. Restart postfix (as root)
sudo /etc/init.d/postfix reload