-1

I'm trying to sending email from nagios monitoring to some email addresses. But I have a problem with setup my from domain when I'm sending an email every time my from email address seems like this:

from=<root@patrik-VirtualBox>

and format like this some mail servers are rejecting.

so I need replace @patrik-VirtualBox to my domain @onedata.sk

here is my /etc.postfix/main.cf:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
config_directory = /etc/postfix
home_mailbox = Maildir/
inet_interfaces = all
mailbox_command =
mailbox_size_limit = 0
mydestination = mail.onedata.sk, localhost.localdomain, localhost, yourdomain.com
myhostname = onedata.sk
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_tls_cert_file = /etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file = /etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes

from log:

Feb  3 01:55:56 patrik-VirtualBox postfix/pickup[10655]: E2FFA66C36: uid=0 from=<root@patrik-VirtualBox>
Feb  3 01:55:56 patrik-VirtualBox postfix/cleanup[10963]: E2FFA66C36: message-id=<20150203005556.E2FFA66C36@onedata.sk>
Feb  3 01:55:56 patrik-VirtualBox postfix/qmgr[10656]: E2FFA66C36: from=<root@patrik-VirtualBox>, size=340, nrcpt=1 (queue active)
Feb  3 01:56:35 patrik-VirtualBox postfix/smtp[10965]: E2FFA66C36: to=<patrik.kristel@onedata.sk>, relay=mailhub.nextra.sk[195.168.1.42]:25, delay=38, delays=0.03/0.01/30/8, dsn=5.0.0, status=bounced (host mailhub.nextra.sk[195.168.1.42] said: 517 Syntax error. (in reply to MAIL FROM command))

I have also tried to set up relayhost or this topic, but it didn't help.

I have configured it in another server like this and there it works fine, so I don't understand why it doesn't work.

Patrik18
  • 111
  • 2
  • 1
    It's not postfix fault, the sender was set by nagios. See this question [Defining the email address which Nagios sends emails from](http://serverfault.com/questions/73004/defining-the-email-address-which-nagios-sends-emails-from) – masegaloeh Feb 03 '15 at 03:56
  • it is not issue with Nagios, I'm trying to send email like root at first, e.g.: `root@patrik-VirtualBox:~# echo "test" | mail -s "test mail" patrik.kristel@onedata.sk` and it is rejected because the from email address is `root@patrik-VirtualBox` – Patrik18 Feb 03 '15 at 04:35
  • 1
    Set your server hostname to FQDN one. **Postfix doesn't set the sender address**, it was set by nagios/mail command. – masegaloeh Feb 03 '15 at 05:16

3 Answers3

0

Nagios just uses /usr/bin/mail (by default). You can change the args that are passed to the mail binary; it's just a single line in the notification command definition.

You can change the from address by adding something like -- -f nagios@onedata.sk to the end of the line. This will cause the -f to be passed to sendmail, to set the 'envelope from' address.

(In Debian/Ubuntu, this is done in /etc/nagios3/commands.cfg. I'm not sure about other distro packages.)

Keith
  • 4,627
  • 14
  • 25
0

I resolved it by changing the /etc/hostname configuration file:

https://askubuntu.com/questions/158957/how-to-set-the-fully-qualified-domain-name-in-12-04

Patrik18
  • 111
  • 2
-1

Set your domain in

/etc/mailname

Then restart postfix

/etc/init.d/postfix restart

Then, try again.