4

I think I need a way to debug in more detail how Joomla is trying to send SMTP email because I can't get any of its email mechanisms working, but I feel like SMTP is the one most likely to work since I've gotten SMTP email working on the same host with other test code. The error I am receiving when trying to send a private message from the primary super user account to another super user account using Components -> Messaging -> New Private Message is as follows:

Notice
SMTP Error: data not accepted.

My SMTP settings in the global configuration are as follows:

Send Mail: Yes
Mailer: SMTP
From email: [email protected]
From name: Benjamin Marty
Disable Mass Mail: No
SMTP Authentication: Yes
SMTP Security: None
SMTP Port: 25
SMTP Username: [email protected]
SMTP Password: (same password I used in the script below)
SMTP Host: mail.sgdk2.enigmadream.com

When the failure occurred, I decided to try a test using PHPMailer from https://github.com/PHPMailer/PHPMailer and the following script recommended by Dreamhost at http://wiki.dreamhost.com/PHPMailer:

<?php
/**
* This example shows making an SMTP connection with authentication.
*/

//SMTP needs accurate times, and the PHP timezone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');

require 'PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;

//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';

//Set the hostname of the mail server
$mail->Host = "mail.sgdk2.enigmadream.com";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = "[email protected]";
//Password to use for SMTP authentication
$mail->Password = "See Comment"; // I used the same password configured above
//Set who the message is to be sent from
$mail->setFrom('[email protected]', 'Benjamin Marty');
//Set an alternative reply-to address
$mail->addReplyTo('[email protected]', 'Benjamin Marty');
//Set who the message is to be sent to
$mail->addAddress('[email protected]', 'Ben Marty');

//Set the subject line
$mail->Subject = 'PHPMailer SMTP test';
//if you want to include text in the body. 
$mail->Body    = "This is a test of email";

//send the message, check for errors
if (!$mail->send()) {
   echo "Mailer Error: " . $mail->ErrorInfo;
} else {
   echo "Message sent!";
}
?>

The PHP script was installed in a sub-directory of where I have Joomla installed, and it works just fine. But Joomla doesn't. How do I narrow down the problem?

1 Answer 1

3

It looks like the problem was that Joomla uses the From address of the user sending the message instead of the From address configured in the global configuration's server settings. When I changed the super user's email address to match the addresses in my other test, then the email went through.

5
  • Glad you figured it out.. You beat me to it, I was just about to ask you what is the sender's email address, knowing that most of SMTP servers require that FromAddress and Username be the same...
    – Mikan
    Feb 29, 2016 at 15:22
  • @MirkoMikan This should be considered a Joomla bug, right? If the SMTP server settings have a From address, there should be a way to make sure that From address gets used, shouldn't there? Do you know where I could go next in determining whether this is a bug and reporting it? (The sender should be used in reply-to, not from, IMO.)
    – BlueMonkMN
    Feb 29, 2016 at 15:24
  • I wouldn't go that far in claiming that's a Joomla bug, In my eight years of working with her I would always think first as my lack of knowledge and experience, and never-ever thought I found her bug. But if you are certain its a bug you can always try docs.joomla.org/Filing_bugs_and_issues
    – Mikan
    Feb 29, 2016 at 16:16
  • 1
    I usually think that too, but this case is simple enough that, even though I have very limited experience with Joomla, my 20+ years of general programming experience is telling me that this is at least worth submitting for consideration as a bug. I've noticed at least in the software I write, there are too many problems that people just deal with instead of reporting. So it'll be interesting to see what happens with issues.joomla.org/tracker/joomla-cms/9261
    – BlueMonkMN
    Feb 29, 2016 at 19:06
  • I will follow this Issue #9261 closely.
    – Mikan
    Mar 1, 2016 at 10:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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