Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
mail, postfix, etc.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
jimmij
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2008
Posts: 143

PostPosted: Tue Dec 02, 2008 9:14 pm    Post subject: mail, postfix, etc. Reply with quote

Hello all,

There were many topics about postfix configuration on this forum as well as in other places but after googling many hours I still cannot configure postfix to suit my needs. I just want to use cron and command "at" on a my notebook. I use it at different places (home, work, etc.) and sometimes I just use it offline, so I cannot fill such variables as "myhostname" or "mydomain" in /etc/postfix/main.cf, what most of postfix howtos propose.
Can anybody give an example how to configure this postfix? Or maybe I need something else (e.g. ssmtp?). I'm completely newbie in this task...

Here is how my /etc/postfix/main.cf looks so far:
Code:
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
unknown_local_recipient_reject_code = 550
debug_peer_level = 2
debugger_command =
    PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
    ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
setgid_group = postdrop
html_directory = /usr/share/doc/postfix-2.5.5/html
manpage_directory = /usr/share/man
sample_directory = /etc/postfix
readme_directory = /usr/share/doc/postfix-2.5.5/readme
home_mailbox = .maildir/


Thanks in advance for any help.
Back to top
View user's profile Send private message
poly_poly-man
Advocate
Advocate


Joined: 06 Dec 2006
Posts: 2477
Location: RIT, NY, US

PostPosted: Wed Dec 03, 2008 1:10 am    Post subject: Reply with quote

if you only want to forward your mail to a "real" mail server, use ssmtp.

Otherwise:

I tried to set up postfix for my network, and it was a complete PITA.

sendmail, for my configuration at least, was much easier to get working. Start off with a good tutorial online and you'll do fine.
_________________
iVBORw0KGgoAAAANSUhEUgAAA

avatar: new version of logo - see topic 838248. Potentially still a WiP.
Back to top
View user's profile Send private message
jimmij
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2008
Posts: 143

PostPosted: Wed Dec 03, 2008 11:59 pm    Post subject: Reply with quote

poly_poly-man wrote:
if you only want to forward your mail to a "real" mail server, use ssmtp.

Otherwise:

I tried to set up postfix for my network, and it was a complete PITA.

sendmail, for my configuration at least, was much easier to get working. Start off with a good tutorial online and you'll do fine.


I juar want to send all mails to /var/spool/mail/username, not to "real" mail server. Do you think sendmail is the best for that trivial (as I see it) work? AFAIK postfix developers claim that postfix is a way easier to configure than sendmail so I'm confused...
Back to top
View user's profile Send private message
poly_poly-man
Advocate
Advocate


Joined: 06 Dec 2006
Posts: 2477
Location: RIT, NY, US

PostPosted: Thu Dec 04, 2008 1:19 am    Post subject: Reply with quote

jimmij wrote:
poly_poly-man wrote:
if you only want to forward your mail to a "real" mail server, use ssmtp.

Otherwise:

I tried to set up postfix for my network, and it was a complete PITA.

sendmail, for my configuration at least, was much easier to get working. Start off with a good tutorial online and you'll do fine.


I juar want to send all mails to /var/spool/mail/username, not to "real" mail server. Do you think sendmail is the best for that trivial (as I see it) work? AFAIK postfix developers claim that postfix is a way easier to configure than sendmail so I'm confused...
you probably want sendmail hooked into procmail.

Postfix devs are liars :P
_________________
iVBORw0KGgoAAAANSUhEUgAAA

avatar: new version of logo - see topic 838248. Potentially still a WiP.
Back to top
View user's profile Send private message
jcat
Veteran
Veteran


Joined: 26 May 2006
Posts: 1337

PostPosted: Thu Dec 04, 2008 2:48 am    Post subject: Re: mail, postfix, etc. Reply with quote

jimmij wrote:
Hello all,

There were many topics about postfix configuration on this forum as well as in other places but after googling many hours I still cannot configure postfix to suit my needs. I just want to use cron and command "at" on a my notebook. I use it at different places (home, work, etc.) and sometimes I just use it offline, so I cannot fill such variables as "myhostname" or "mydomain" in /etc/postfix/main.cf, what most of postfix howtos propose.
Can anybody give an example how to configure this postfix? Or maybe I need something else (e.g. ssmtp?). I'm completely newbie in this task...



Why does that mean you can't specify myhostname or mydomain? They are just local variable. On a laptop it's often best to set your hostname to resolve to 127.0.0.1, instead of an IP address from your NIC.

I have postfix running without issue on my laptop, just for local mail delivery. I guess everything's relative, but it's not hard to configure :)


Set your hostname as suggested above, make up a domain, then start postfix. Don't forget to set the smtpd to verbose in master.cf, then you can diagnose faults better using your logs (don't forget to disable verbose logging later).

If you need assistance, post back.

BTW Don't bother with ssmpt, it's not actively developed any more as far as I know.



Cheers,
jcat
Back to top
View user's profile Send private message
rweaver
n00b
n00b


Joined: 04 Dec 2008
Posts: 1
Location: Independence, Ohio

PostPosted: Thu Dec 04, 2008 9:36 pm    Post subject: Reply with quote

From your description it sounds more like you should be looking into using fetchmail, msmtp/ssmtp, and procmail rather than a mail transport agent like sendmail or postfix. Fetchmail takes care of mail delivery to your local computer from a wide variety of sources (without requiring you to have mx records pointing mail to your machine) and in combination the three programs will let you perform any operations you might want to perform on both incoming and outgoing mail from your system in a configurable and reliable manner. If you want to get deeper into the configuration it's even possible to configure the entire system to work with spamassassin to eliminate spam too.

The fetchmail homepage has several links that should explain to you more fully what fetchmail can do and push you in the right direction towards a solution to your email problems.

http://fetchmail.berlios.de/

Hope it helps!

Ralph
_________________
Pantek, Inc. - http://www.pantek.com/ - info@pantek.com
+1-877-LINUX-FIX - Expert Open Source Technical Support
Back to top
View user's profile Send private message
Dralnu
Veteran
Veteran


Joined: 24 May 2006
Posts: 1919

PostPosted: Thu Dec 04, 2008 10:28 pm    Post subject: Reply with quote

I'm going to suggest esmtp over ssmtp. I've been using it myself on my desktop, and it works wonderfully. It is simple, and can handle local mail w/ procmail.
_________________
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
Back to top
View user's profile Send private message
jimmij
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2008
Posts: 143

PostPosted: Sat Dec 06, 2008 9:02 pm    Post subject: Reply with quote

OK, so I've emerged fetchmail, procmail and ssmtp. Lets try:
Code:

21:41:24 root@phdlap2 ~> echo test | mail -s test root
send-mail: Cannot open localhost:25
Can't send mail: sendmail process failed with error code 1
21:41:44 root@phdlap2 ~>

Here is how /etc/ssmtp/ssmtp.conf looks like
Code:

21:49:28 root@phdlap2 ~> grep -v # /etc/ssmtp/ssmtp.conf | grep -v ^$
root=postmaster
mailhub=localhost
rewriteDomain=
hostname=localhost
21:49:34 root@phdlap2 ~>

and /etc/hosts:
Code:

21:50:50 root@phdlap2 ~> grep -v # /etc/hosts | grep -v ^$
127.0.0.1   localhost phdlap2
21:50:57 root@phdlap2 ~>

Perhaps logs from /var/log/messages will be useful too:
Quote:

Dec 6 21:41:44 phdlap2 sSMTP[1192]: Unable to connect to "localhost" port 25.
Dec 6 21:41:44 phdlap2 sSMTP[1192]: Cannot open localhost:25

If I change parameter "mailhub" in ssmtp.conf from localhost to phdlap2 then error change respectively. Any further suggestions?

BTW, I've put mbox into /etc/make.conf - it seems that procmail needs it to put mails into /var/spool/mail, right?
Back to top
View user's profile Send private message
poly_poly-man
Advocate
Advocate


Joined: 06 Dec 2006
Posts: 2477
Location: RIT, NY, US

PostPosted: Sun Dec 07, 2008 12:36 am    Post subject: Reply with quote

ahem... ssmtp needs an MTA... usually on another computer (I don't think it's possible to run an MTA alongside it... possibly).

There's probably a small MTA available, but ssmtp isn't it.

BTW: MTA = the daemon on port 25. It handles moving the mail to where it has to go. ssmtp is a very VERY basic one... without listening on port 25 even. It simply routes all mail given to it directly to another computer's port 25 to be handled by a REAL mta.
_________________
iVBORw0KGgoAAAANSUhEUgAAA

avatar: new version of logo - see topic 838248. Potentially still a WiP.
Back to top
View user's profile Send private message
jimmij
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2008
Posts: 143

PostPosted: Sun Dec 07, 2008 1:22 am    Post subject: Reply with quote

Very well, so I've installed sendmail instead of ssmtp and there is some progress :)
I can send mail via "echo foo | mail -s bar root", but sending takes veeeery long (~2 minutes) and in logs I see
Code:

sendmail[6971]: My unqualified host name (localhost) unknown; sleeping for retry
sendmail[6971]: unable to qualify my own domain name (localhost) -- using short name

How to correct this?
Back to top
View user's profile Send private message
Dralnu
Veteran
Veteran


Joined: 24 May 2006
Posts: 1919

PostPosted: Sun Dec 07, 2008 1:26 am    Post subject: Reply with quote

look into esmtp
_________________
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
Back to top
View user's profile Send private message
jimmij
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2008
Posts: 143

PostPosted: Sun Dec 07, 2008 1:41 am    Post subject: Reply with quote

Dralnu wrote:
look into esmtp

esmtp doesn't work for me (at least with default configuration):
Code:

2:38:05 root@phdlap2 ~> echo adsf | mail -s dfa root
Local delivery not possible without a MDA
Can't send mail: sendmail process failed
Back to top
View user's profile Send private message
poly_poly-man
Advocate
Advocate


Joined: 06 Dec 2006
Posts: 2477
Location: RIT, NY, US

PostPosted: Sun Dec 07, 2008 1:48 am    Post subject: Reply with quote

jimmij wrote:
Very well, so I've installed sendmail instead of ssmtp and there is some progress :)
I can send mail via "echo foo | mail -s bar root", but sending takes veeeery long (~2 minutes) and in logs I see
Code:

sendmail[6971]: My unqualified host name (localhost) unknown; sleeping for retry
sendmail[6971]: unable to qualify my own domain name (localhost) -- using short name

How to correct this?

fix up your /etc/hosts.conf...

...of course, you should be running bind on your system anyway :P
_________________
iVBORw0KGgoAAAANSUhEUgAAA

avatar: new version of logo - see topic 838248. Potentially still a WiP.
Back to top
View user's profile Send private message
Dralnu
Veteran
Veteran


Joined: 24 May 2006
Posts: 1919

PostPosted: Sun Dec 07, 2008 1:52 am    Post subject: Reply with quote

jimmij wrote:
Dralnu wrote:
look into esmtp

esmtp doesn't work for me (at least with default configuration):
Code:

2:38:05 root@phdlap2 ~> echo adsf | mail -s dfa root
Local delivery not possible without a MDA
Can't send mail: sendmail process failed


Set mda="usr/bin/procmail -d %T"
_________________
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
Back to top
View user's profile Send private message
jimmij
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2008
Posts: 143

PostPosted: Sun Dec 07, 2008 1:54 am    Post subject: Reply with quote

poly_poly-man wrote:
jimmij wrote:
Very well, so I've installed sendmail instead of ssmtp and there is some progress :)
I can send mail via "echo foo | mail -s bar root", but sending takes veeeery long (~2 minutes) and in logs I see
Code:

sendmail[6971]: My unqualified host name (localhost) unknown; sleeping for retry
sendmail[6971]: unable to qualify my own domain name (localhost) -- using short name

How to correct this?

fix up your /etc/hosts.conf...

Do you mean /etc/hosts (I don't have such file as /etc/hosts.conf)?
And what exactly should I correct? I have only one line there:
Code:

127.0.0.1       localhost phdlap2
Back to top
View user's profile Send private message
poly_poly-man
Advocate
Advocate


Joined: 06 Dec 2006
Posts: 2477
Location: RIT, NY, US

PostPosted: Sun Dec 07, 2008 1:57 am    Post subject: Reply with quote

jimmij wrote:
poly_poly-man wrote:
jimmij wrote:
Very well, so I've installed sendmail instead of ssmtp and there is some progress :)
I can send mail via "echo foo | mail -s bar root", but sending takes veeeery long (~2 minutes) and in logs I see
Code:

sendmail[6971]: My unqualified host name (localhost) unknown; sleeping for retry
sendmail[6971]: unable to qualify my own domain name (localhost) -- using short name

How to correct this?

fix up your /etc/hosts.conf...

Do you mean /etc/hosts (I don't have such file as /etc/hosts.conf)?
And what exactly should I correct? I have only one line there:
Code:

127.0.0.1       localhost phdlap2

oopsie.. yep,. that's what I meant (running off memory)

127.0.0.1 penguin.lan penguin localhost.localdomain localhost

is mine... try something like that (might help, probably won't).
_________________
iVBORw0KGgoAAAANSUhEUgAAA

avatar: new version of logo - see topic 838248. Potentially still a WiP.
Back to top
View user's profile Send private message
jimmij
Tux's lil' helper
Tux's lil' helper


Joined: 02 Dec 2008
Posts: 143

PostPosted: Sun Dec 07, 2008 2:10 am    Post subject: Reply with quote

Yeah! I added alias localhost.localdomain in /etc/hosts and it works perfectly, thanks!

I've removed also fetchmail and ended with procmail+sendmail, I will not bother to find other solutions anymore ;)

Thank you all for help!
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
Page 1 of 1

 
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