LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-27-2009, 07:30 AM   #1
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Rep: Reputation: 33
CentOS : mail logfile with program 'mutt'


I've found this interesting program 'mutt' to send a logfile as attachment to a mail-address.

But when I issue this command :

Code:
mutt -s "test" -a /home/jonas/testfile.odt jonas.kellens@domain.tld < /dev/null
my mail is not delivered to the specified mail-address.

Is this because I have not yet configured a mail-server on my CentOS-server ? I thought that with a default installation mailing was possible ?!

To specify : I just want to send mail from the CentOS-server (every week a logfile), not be able to receive mail.

mutt -v
Code:
SENDMAIL="/usr/sbin/sendmail"
MAILPATH="/var/mail"
PKGDATADIR="/usr/share/mutt"
SYSCONFDIR="/etc"
EXECSHELL="/bin/sh"

Or another mailscript ???

Last edited by jonaskellens; 04-27-2009 at 08:12 AM.
 
Old 04-27-2009, 11:51 PM   #2
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Have a look in your maillog for why it isn't working (/var/log/maillog)

What happens if you interactively issue

mutt -s "test" -a /home/jonas/testfile.odt jonas.kellens@domain.tld
 
Old 04-28-2009, 01:30 AM   #3
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by billymayday View Post
Have a look in your maillog for why it isn't working (/var/log/maillog)

What happens if you interactively issue

mutt -s "test" -a /home/jonas/testfile.odt jonas.kellens@domain.tld
Code:
Apr 27 14:27:06 jonas sendmail[26582]: n3RCR65M026582: to=<jonas.kellens@telenet.be>, delay=00:00:00, mailer=esmtp, pri=30377, dsn=4.4.3, stat=queued
Apr 27 14:27:06 jonas sendmail[26581]: n3RCR62Y026581: to=jonas.kellens@telenet.be, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30073, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (n3RCR65M026582 Message accepted for delivery)
Apr 27 14:31:10 jonas sendmail[26797]: n3RCVAeV026797: from=root, size=73, class=0, nrcpts=1, msgid=<200904271231.n3RCVAeV026797@localhost.localdomain>, relay=root@localhost
Apr 27 14:31:10 jonas sendmail[26799]: n3RCVAKH026799: from=<root@localhost.localdomain>, size=377, class=0, nrcpts=1, msgid=<200904271231.n3RCVAeV026797@localhost.localdomain>, proto=ESMTP, daemon=MTA, relay=jonas [127.0.0.1]
Apr 27 14:31:10 jonas sendmail[26799]: n3RCVAKH026799: to=<jonas.kellens@telenet.be>, delay=00:00:00, mailer=esmtp, pri=30377, dsn=4.4.3, stat=queued
Apr 27 14:31:10 jonas sendmail[26797]: n3RCVAeV026797: to=jonas.kellens@telenet.be, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30073, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (n3RCVAKH026799 Message accepted for delivery)

When I execute the command, nothing prints on the CLI.
In verbose mode it gives me the version number and some configuration info about the program.
 
Old 04-28-2009, 01:39 AM   #4
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Is the message delivered? I looks like it is
 
Old 04-28-2009, 01:59 AM   #5
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by billymayday View Post
Is the message delivered? I looks like it is
When I check my mailbox jonas.kellens@telenet.be, I have not received any message...

Maybe to be more clear : jonas.kellens@telenet.be is an external mailbox @ an external host on the internet.
My CentOS-box is inside my own network, and behind NAT.
Also : the firewall is off course not blocking port 25.

I don't know if with a default installation this mailscript is able to speak SMTP ?
 
Old 04-28-2009, 02:16 AM   #6
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Can you send to a local account?

I'm useless on sendmail
 
Old 04-30-2009, 02:42 AM   #7
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Original Poster
Rep: Reputation: 33
Actually, can someone tell me what it is that I need to be able to send mail to the internet (an external mail-server) ?

What I have now is :
- a dynamic IP-address from my ISP, no domain-name
- a CentOS-server, default install, with Asterisk installed on my LAN (192.168.4.248)
- a firewall/default gw (192.168.4.250) that has nothing blocked.

What I would like to do :
- send my log-files to jonas.kellens@ISP_domain.tld
- send my Call Detail Record-files (.csv) to jonas.kellens@ISP_domain.tld

I have never setup a mailserver before, but is this necessary ?!
Is it necessary to have a domain name ? I could do this with dynDNS.

Sending a mail now would mean I do this with the sender-address "root@asterisk". How will this ever reach the SMTP-server of my ISP ?!

If someone can just tell me what I need, I'll be on my way.
Don't need no details... enough info is available.
Just tell me if I need a domain-name or a mailserver (sendmail) or does everything has to work with a default install also ??

Personally, I don't think a need a domain-name cause else I wouldn't be able to send with a GUI MUA either from one of my internal Fedora clients...

Last edited by jonaskellens; 04-30-2009 at 02:47 AM.
 
Old 04-30-2009, 02:51 AM   #8
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
I believe the concept you need to search for in sendmail is a smarthost - ie relay through your ISP's server. That way you won't need a domain name or similar so long as you don't want to receive mail - and you are saying you only want to send. You will probably want to set the Reply-To header to a personal account in this case.
 
Old 04-30-2009, 03:00 AM   #9
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by billymayday View Post
I believe the concept you need to search for in sendmail is a smarthost - ie relay through your ISP's server. That way you won't need a domain name or similar so long as you don't want to receive mail - and you are saying you only want to send. You will probably want to set the Reply-To header to a personal account in this case.
Yes I just want to send, not receive. If my Asterisk-server sends log-files to my mail-address, I do not want to reply with a "thank you" :-).

So... if I want to send mail (+ attachment) with mutt, which uses sendmail, I need to configure a smarthost.

Google tells me :

Quote:
The SMART_HOST macro allows you to specify the host that should relay all outgoing mail that you are unable to deliver directly, and the mail transport protocol to use to talk to it.

Open your configuration file:
# vi /etc/mail/sendmail.mc
Append or modify macro that read as follows :
define(`SMART_HOST',`smtp.telenet.be').
If line contains word, dnl remove the dnl word.
Regenerate a new sendmail.cf config file with m4 command:
# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
Restart sendmail service:
# /etc/init.d/sendmail restart
But how will this smarthost authenticate to the smtp-server of my ISP ?
What will be the sender-address in this case ??
 
Old 04-30-2009, 03:49 AM   #10
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
As I said, I don't use sendmail - I'm just trying to point you in the right direction. It may be a good idea to start a new thread since you are now onto a different problem.
 
Old 05-03-2009, 01:05 PM   #11
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Original Poster
Rep: Reputation: 33
What do I need to mail logfiles...

Hi there !

What is it that I need to be able to send logfiles from my CentOS-box to my external mail-account ?

So I have a mailaccount jonas.kellens@my-isp.tld and I want my CentOS-server to send me weekly the logfiles as attachment.

So... what do I need ?

The setup I would like :
1. I can execute a mail-command from a crontab (cron.weekly)
2. The sender-address is hostname@my-domain.local
3. I can set the subject of the mail
4. The mail must not be replied to... (so I guess I don't need a fixed IP-address and domainname and MX-record in DNS for lookup)

I am currently looking at postfix as mailserver. I would then add the function of mailserver to my CentOS-box, create a mailaccount and also install a MUA like 'mutt' to be able to send a mail with attachment.

Is this the way to go ? Or is the solution much simpler ?
 
Old 05-03-2009, 02:11 PM   #12
penguiniator
Member
 
Registered: Feb 2004
Location: Olympia, WA
Distribution: SolydK
Posts: 442
Blog Entries: 3

Rep: Reputation: 60
You may want to look at msmtp and nail.
 
Old 05-03-2009, 03:37 PM   #13
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by penguiniator View Post
You may want to look at msmtp and nail.
msmtp is interesting, although I see no option for sending an attachment...


I was experiencing with mutt :
Code:
[root@asterisk asterisk]# mutt -s "test mail logfiles" -a /var/log/asterisk/verbose jonas.kellens@telenet.be < /dev/null
But that doesn't work :

Code:
May  3 19:52:00 asterisk sendmail[4188]: n43Hneph004188: from=<root@asterisk.nw.local>, size=170850, class=0, nrcpts=1, msgid=<20090503174940.GA4182@asteris
k.nw.local>, proto=ESMTP, daemon=MTA, relay=asterisk.nw.local [127.0.0.1]
May  3 19:52:00 asterisk sendmail[4187]: n43HneXr004187: to=jonas.kellens@telenet.be, ctladdr=root (0/0), delay=00:02:20, xdelay=00:02:20, mailer=relay, pri
=200693, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (n43Hneph004188 Message accepted for delivery)
May  3 19:52:20 asterisk sendmail[4194]: n43Hneph004188: to=<jonas.kellens@telenet.be>, delay=00:01:40, xdelay=00:00:20, mailer=esmtp, pri=290850, relay=smt
p-telenet.telenet-ops.be. [195.130.137.65], dsn=4.0.0, stat=Deferred: Name server: smtp-telenet.telenet-ops.be.: host name lookup failure
May  3 20:45:29 asterisk sendmail[4326]: n43Hi9X0003096: to=<root@asterisk.nw.local>, delay=01:00:00, xdelay=00:00:20, mailer=esmtp, pri=124296, relay=smtp.
telenet-ops.be. [195.130.133.71], dsn=4.0.0, stat=Deferred: Name server: smtp.telenet-ops.be.: host name lookup failure
May  3 20:45:49 asterisk sendmail[4326]: n43Hneph004188: to=<jonas.kellens@telenet.be>, delay=00:55:09, xdelay=00:00:20, mailer=esmtp, pri=380850, relay=smt
p-telenet.telenet-ops.be. [195.130.137.65], dsn=4.0.0, stat=Deferred: Name server: smtp-telenet.telenet-ops.be.: host name lookup failure
May  3 20:45:49 asterisk sendmail[4326]: n43DLnJE003948: to=<root@asterisk.nw.local>, delay=05:23:00, xdelay=00:00:00, mailer=esmtp, pri=393071, relay=smtp.
telenet-ops.be., dsn=4.0.0, stat=Deferred: Name server: smtp.telenet-ops.be.: host name lookup failure
May  3 20:45:49 asterisk sendmail[4326]: n3UG7HQP005480: to=<jonas.kellens@telenet.be>, delay=3+02:35:52, xdelay=00:00:00, mailer=esmtp, pri=1380487, relay=
smtp-telenet.telenet-ops.be., dsn=4.0.0, stat=Deferred: Name server: smtp-telenet.telenet-ops.be.: host name lookup failure
My /etc/resolv.conf file points to my default gateway/router/DNS.
I don't understand why lookup fails...

Last edited by jonaskellens; 05-03-2009 at 03:45 PM.
 
Old 05-03-2009, 03:45 PM   #14
penguiniator
Member
 
Registered: Feb 2004
Location: Olympia, WA
Distribution: SolydK
Posts: 442
Blog Entries: 3

Rep: Reputation: 60
You can use nail and msmtp together. nail as the client and msmtp for pop access to your isp. Nail supports attachments.
 
Old 05-03-2009, 03:48 PM   #15
jonaskellens
Member
 
Registered: Jul 2008
Location: Ghent, Belgium
Distribution: Fedora, CentOS
Posts: 632

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by penguiniator View Post
You can use nail and msmtp together. nail as the client and msmtp for pop access to your isp. Nail supports attachments.
I should be able to use mutt also together with msmtp... according to the man-page.

But something tells me I will get the same 'lookup failure'...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell scripting: Print output to logfile, error to logfile & screen stefanlasiewski Programming 18 05-22-2008 01:47 PM
need help with mutt or mail rhea Linux - Software 3 02-04-2006 12:37 AM
Writing shell script with mail < logfile humbletech99 Programming 2 11-22-2005 09:20 AM
Mutt and IMAP new mail/mark read mail checks(plzzz help) rmanocha Linux - Software 0 09-15-2004 03:05 PM
setting up mutt mail jkilbourne Linux - Newbie 0 01-29-2002 01:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration