Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm running a perl script which wil create weekly report in CSV format. I want this report be emailed to the manager.

hence I am trying to configure Sendmail on my RHEL 5.6 server so that I can write a bash script to send this report as an attachment.

But I am not able to do that. I have done below entry in the senmail.mc file:

define(`SMART_HOST', `<my_smtp_server>')dnl

where is my companies mail server and I removed the name for brevity.

Then I restarted the sendmail service and tried sending email with "mail" command but i did not receive it.

Am I missing any other steps in send mail configuration ?

Thanks for the help in advance.

@adamo, Please find the sendmail information:

# ps -eaf | grep sendmail
root      3612  3560  0 03:58 pts/0    00:00:00 grep sendmail
root     32176     1  0 Jul31 ?        00:00:00 sendmail: Queue runner@01:00:00 for /var/spool/mqueue
smmsp    32186     1  0 Jul31 ?        00:00:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue

# netstat -anp | grep 25

# netstat -anp | grep sendmail
unix  2      [ ]         DGRAM                    2027690 32186/sendmail: Que
unix  2      [ ]         DGRAM                    2027675 32176/sendmail: Que

# egrep -v "^dnl|^$" /etc/mail/sendmail.mc
divert(-1)dnl
include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
VERSIONID(`setup for linux')dnl
OSTYPE(`linux')dnl
define(`confDEF_USER_ID', ``8:12'')dnl
define(`confTO_CONNECT', `1m')dnl
define(`confTRY_NULL_MX_LIST', `True')dnl
define(`confDONT_PROBE_INTERFACES', `True')dnl
define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl
define(`ALIAS_FILE', `/etc/aliases')dnl
define(`STATUS_FILE', `/var/log/mail/statistics')dnl
define(`UUCP_MAILER_MAX', `2000000')dnl
define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl
define(`confAUTH_OPTIONS', `A')dnl
define(`confTO_IDENT', `0')dnl
FEATURE(`no_default_msa', `dnl')dnl
FEATURE(`smrsh', `/usr/sbin/smrsh')dnl
FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl
FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl
FEATURE(redirect)dnl
FEATURE(always_add_domain)dnl
FEATURE(use_cw_file)dnl
FEATURE(use_ct_file)dnl
FEATURE(local_procmail, `', `procmail -t -Y -a $h -d $u')dnl
FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl
FEATURE(`blacklist_recipients')dnl
EXPOSED_USER(`root')dnl
DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
FEATURE(`accept_unresolvable_domains')dnl
LOCAL_DOMAIN(`localhost.localdomain')dnl
MAILER(smtp)dnl
MAILER(procmail)dnl
#

the 128.0.0.1 is there in my fedora as well and it works fine. thanks for your time.

share|improve this question
1  
what's your mail.log saying? - –  Olli Jul 31 '12 at 7:30
    
The most likely step you have forgotten is checking whether your company's mail server requires authorisation. This is usually either a username/password or IP address based. It's also possible that you mistyped the mail server's address (you mistyped the config file's name so typos are not out of the question). Either way, the log should tell you what's going on. –  Ladadadada Jul 31 '12 at 7:44
    
So, I compared my Fedora and RHEL5.6 configuration. sendmail is working on fedora and I can send emails from their. also I find that sendmail is listening on port "25" on fedora. However, on RHEL5.6, it is not listening anything. i restarted the sendmail service, no iptables, still it does not listen. Now, why would it be not listening on port 25? –  slayedbylucifer Jul 31 '12 at 9:42
    
It maybe listening on port 25 on 127.0.0.1 instead of your external interface. Post your sendmail.mc file –  adamo Jul 31 '12 at 12:57
    
@adamo, I have uploaded the information in my original post. Please have a look and let me know where I am going wrong. Thanks for your time. –  slayedbylucifer Aug 1 '12 at 11:02

2 Answers 2

What would stop you from using Perl's Mail::Send module?

share|improve this answer

I would have a bash script run from cron that after generating the report would mail it as an attachment to the manager by using mutt. The relevant line would be like:

date | mutt -x -s"Weekly report" -a report.csv manager@example.com
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.