3

I want to send emails from my server through external mail server. So I installed nullmailer as one of simpliest MTA in Debian 7 x32.

My /etc/nullmailer/remotes:

smtp.example.com smtp --user=sender@example.com --pass=*** --port 465 --ssl

user in this case is registered user on remote server.

Now I want to send a test mail. Nullmailer replacement for sendmail has several parameters:

usage: sendmail [flags] [recipients]

-f Set the envelope sender address

OK, so I send the mail with:

ls | sendmail -f sender@example.com  recipient@example.com

But this mail come to sender@example.com mailbox. One of headers says:

To: undisclosed-recipients:;

As I understand nullmailer doesn't send recipient address.

OK, Now I try to send it through php:

mail("recipient@example.com","subject","message","From: sender@example.com");

But nothing sent in fact. The log says:

smtp: Failed: 553 5.7.1 Sender address rejected: not owned by auth user. Sending failed: Permanent error in sending the message

Hmm ... looks strange. If I list nullmailer queue I see

sendmail -bp

2015-03-23 14:58:26 332 bytes from <root@example.com>
  to <sender@example.com>

I don't know from where this root@example.com came. So queue is frozen now. I 've found the queue in /var/spool/nullmailer/queue/. Each email saved as file with header and message body. A file looks like:

root@example.com
sender@example.com

Received: (nullmailer pid 14630 invoked by uid 0);
Mon, 23 Mar 2015 04:58:26 -0000 
To: recipient@example.com 
Subject: subject 
X-PHP-Originating-Script: 0:test.php 
From: sender@example.com Date: Mon, 23 Mar 2015 14:58:26 +1000 Message-Id: 1427086706.909885.14629.nullmailer@example.com>

message

So I changed the header from

root@example.com 
sender@example.com

to

sender@example.com
recipient@example.com

And voila! - the email was sent as expected - from sender@example.com to recipient@example.com

So my question - what I did wrong and how can I send email with nullmailer in normal way?

  • Can you post alll mail.log lines after you send email via sendmail? – masegaloeh Mar 23 '15 at 23:21
  • After trying to send mail log contains only 2 lines I posted above. As I understand nullmailer cannot send email to recipient@example.com and it send it back to root@example.com as error log. If I see the message file in queue - it not contains recepient address (Cc: recipient list not shown: ;) and it can be a problem why original mail was not sent – folibis Mar 23 '15 at 23:49
  • When you invoke ls | sendmail -f sender@example.com recipient@example.com it will fail and nullmailer send the bounce to you right? Can you post the content of email (header + body) of the bounce? – masegaloeh Mar 24 '15 at 2:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.