I have munin v1.4.6 setup on Ubuntu Server 12.04 and configured correctly: the graphs display and munin logs show no errors. However, it keeps emailing the root user instead of my personal email. My /etc/munin/munin.conf has the following contact:
contact.joe.command mail -s "Munin notification" xxxx#gmail.com
When munin runs, I see the following in my /var/log/mail.log:
Aug 26 13:35:34 joe-computer postfix/local[15964]: 581812DFD: to=<root#joe-computer>, orig_to=<root>, relay=local, delay=0.06, delays=0.04/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")
Can anyone help me figure out why it is not mailing "xxxx#gmail.com"?
Related
I have a CentOS7 server that will be deployed to a customer site. I want to get alerts via emails when something goes wrong on the server.
I have an office365 account so I am thinking whether I can use it as a SMTP relay server. (Forgive me here if my words don't make sense since I have very limited knowledge about SMTP and email related technology).
My first question is, do I need to do anything special with the office365 account? I am using smtp.office365.com:587 as the SMTP relay host.
Here is my postfix main.cf config:
relayhost = [smtp.office365.com]:587
smtp_always_send_ehlo = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_generic_maps = hash:/etc/postfix/generic
smtp_tls_security_level = may
smtp_sasl_security_options = noanonymous
Here is my "generic" and "sasl_passwd" file look like. I also used the "postmap" to generate the .db file
/.*/ <o365 email>
root#server.difan.local <o365 email>
root#localdomain <o365 email>
#localdomain <o365 email>
[smtp.office365.com]:587 <o365 email>:<o365 password>
This is the command I used to test it
echo "This is the body of the email" | mail -s "This is the subject line" difan.zhao#outlook.com
Here is what I see in /var/log/maillog
Mar 26 10:46:00 server postfix/pickup[1921]: 5DC594087202: uid=0 from=<root>
Mar 26 10:46:00 server postfix/cleanup[2495]: 5DC594087202: message-id=<20170326164600.5DC594087202#server.difan.local>
Mar 26 10:46:00 server postfix/qmgr[1922]: 5DC594087202: from=<root#server.difan.local>, size=486, nrcpt=1 (queue active)
Mar 26 10:46:00 server postfix/smtp[2497]: warning: SASL authentication failure: No worthy mechs found
Mar 26 10:46:00 server postfix/smtp[2497]: 5DC594087202: SASL authentication failed; cannot authenticate to server smtp.office365.com[40.97.128.34]: no mechanism available
... <last two messages repeated 4 times>
Mar 26 10:46:02 server postfix/smtp[2497]: 5DC594087202: to=<difan.zhao#outlook.com>, relay=smtp.office365.com[40.97.142.194]:587, delay=2.2, delays=0.02/0/2.2/0, dsn=4.7.0, status=deferred (SASL authentication failed; cannot authenticate to server smtp.office365.com[40.97.142.194]: no mechanism available)
Where did I do wrong here? Thanks!
Firstly change your generic files to:
/.*/ email#domain.com
Secondly verify your generic and sasl permissions:
set the owner and permissions.
sudo postmap hash:/etc/postfix/generic
sudo chown root:root /etc/postfix/generic /etc/postfix/generic.db
sudo chmod 644 /etc/postfix/generic /etc/postfix/generic.db
Same to sasl_passwd and db file.
On new versions of Ubuntu/Debian you need install this package: libsasl2-modules
apt install libsasl2-modules
And then reload postfix
systemctl reload postfix
I had to install these... Not sure what they are but they worked!
yum install cyrus-sasl cyrus-sasl-lib cyrus-sasl-plain
On Fedora 21, I had a simple script for sending emails
mail -a /tmp/attachment.txt -s "..." someone#somewhere.com
On Fedora 23, this no longer works.
No configuration file found at /home/mike/.esmtprc or /etc/esmtprc
I created the file and assigned correct permissions to it.
hostname = localhost.localdomain:25
(That's what Fedora 21 would send emails from: mike#localhost.localdomain.)
Well, now I'm getting
SMTP server problem Connection refused
Question: how do I get the mail command to work on Fedora 23?
Okay, seems like Fedora 21 must have had an email server running by default, but Fedora 23 does not.
In my
~/.esmtprc
I had to add
hostname = [SMTP SERVER THAT WORKS]:25
mda "/usr/bin/procmail -d %T"
And that worked. Thanks everyone anyway!
I am trying to use an auto reply program for one of the users.
It works fine when I have user email address defined in .forward file but it gives following error when I put it in script:
Jun 28 12:25:38 localhost sendmail[5210]: s5SJPFkN005208: to="|/home/alpha/autoreply.pl", ctladdr=alpha#localhost (501/501), delay=00:00:10, xdelay=00:00:00, mailer=prog, pri=60446, dsn=5.0.0, stat=Service unavailable
Jun 28 12:25:38 localhost sendmail[5210]: s5SJPFkN005208: s5SJPckN005210: DSN: Service unavailable
Do I have have make any changes in sendmail configs (i.e. symbolic link etc)?
Thanks.
1.Have you checked problems mentioned in sendmail FAQ?
Sendmail-FAQ-3.11: Why can't my users forward their mail to a program?
2. On most linuxes sendmail uses procmail as local mailer program.
You may try to execute your script from ~/.procmailrc of the user.
The issue was /etc/smrsh did not have symbolic link for perl which can be defined as
ln -s /usr/bin/perl /etc/smrsh/perl
I've set up fetchmail with the following configuration
poll my.exchange.server protocol IMAP
user "my_name"
password "my_pass"
smtpname "my_gmail_account#gmail.com"
ssl
keep
no rewrite
mda "/usr/bin/procmail -f %F -d %T"'
Everything seems to be working fine. No errors from fetchmail, and the procmail log contains the e-mails that I want to be forwarded to GMail (an example is pasted below). However, none of the mail ever shows up in my GMail inbox. I've checked the 'All Mail' section to ensure it wasn't being treated as spam. Any ideas what could be going wrong? I'm doing all this on OS X version 10.8.5
Example procmail log for an e-mail that I want to show up in my gmail inbox
From my_exchange_email#my.exchange.server Mon Sep 30 11:03:55 2013
MIME-Version: 1.0
Received: from my.exchange.server [123.45.678.910]
by my_host_name with IMAP (fetchmail-6.3.26)
for <my_gmail_account#gmail.com> (single-drop); Mon, 30 Sep 2013 11:03:55 -0400 (EDT)
I figured out what I was missing. My procmail was configured incorrectly for forwarding. I fixed this by making the following procmailrc file
:0:
! my_gmail_account#gmail.com
That was it!
While working locally on the dev server, GAE doesn't send any emails out. Unless running it with the following command:
dev_appserver.py --enable_sendmail myapp
This would rely on a local sendmail to be setup.
I am using Ubuntu now for some time and I never came across something so difficult to setup.
I came across this solution and 5 other tutorials. The mail.log shows that the email was accepted and sent out, but google times out.
Jun 28 12:13:38 tp sm-mta[15964]: r5SAnXFV014925: to=<kave#gmail.com>, ctladdr=<kave#localhost.localdomain> (1000/1000), delay=00:24:05, xdelay=00:00:00, mailer=esmtp, pri=210342, relay=alt4.gmail-smtp-in.l.google.com., dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com
I would be happy to give up and rely on the log files. But the command line ouput doesn't show the email body:
INFO 2013-06-28 11:17:40,146 mail_stub.py:140] MailService.Send
From: admin#mydomain.com
To: kave#gmail.com
Subject: Invitation to join xxx
Body:
Content-type: text/plain
Data length: 347
It is so frustrating. Any ideas please?
Update:
I have tried to run it with the VM arguments:
But I get this error message:
I ran into this same issue a couple weeks ago. I ended up adding the following VM arguments to eclipse when running the DevAppServer:
-Dmail.log_mail_level=WARNING -Dmail.log_mail_body=true