So on my Ubuntu Server, I use the ssmtp package to handle sending emails on my server. As of recently, emails have not been getting sent. Before posting this topic, I checked my logs and configuration files, and ran ssmtp from the command line, with success. The command that worked was:


However, my PHP script does not send email. This is except of code involving sending mail.

$headers = "From:";
$subject = "TribalWars Assessment";
$message = "Player Name: " . $_POST['player'] . "\r\n";
$message .= "Leadership: " . $answers[0] . " / " . $max[0] . "\r\n";
$message .= "Teamwork: " . $answers[1] . " / " . $max[1] . "\r\n";
$message .= "Loyalty: " . $answers[2] . " / " . $max[2] . "\r\n";
$message .= "Tactics: " . $answers[3] . " / " . $max[3] . "\r\n";
$message .= "Aggression: " . $answers[4] . " / " . $max[4] . "\r\n";
$message .= "Diplomacy: " . $answers[5] . " / " . $max[5] . "\r\n";
ini_set('display_errors', '1');
if (mail("", $subject, $message, $headers)) { echo "Success!!"; }

It is worth note that the "Success!!" never gets displayed. I have also tried $headers with AND without a newline character "\r\n".

After running this code, I checked my system logs and found the following entry involving this email:


/var/log/mail.err      :Oct  5 10:17:03 ac-ubuntu sSMTP[20318]: RCPT TO:<> (553 5.7.1 <>: Sender address rejected: not owned by user

This script is currently owned by acagliano:acagliano. I have also changed it to www-data:rockin (of which acagliano is a member of), and the same error gets printed.

Below I will post the contents of relevant configuration files.



# Config file for sSMTP sendmail
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named

# Where will the mail seem to come from?

# The full hostname

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address



# sSMTP aliases
# Format:       local_account:outgoing_address:mailhub
# Example: root:your_login@your.domain:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.

**Another thing of note... this configuration has worked in the past. Why it is not now I'm not sure about.***
The error appears to be coming from your remote SMTP server, which is saying you're not allowed to send mail from when authenticated as bluiitalian09. Presumably what's happening is your script sets From: to 'root', which gets rewritten to ''.

Explicitly setting the From header may solve your problem.
Well do you see anything in my configuration that could be causing this? I set the From line explicitly in the headers, and from line override is turned on. Is the contents of the revaliases file causing this?
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum