I can send test emails, but there is a caveat, I changed the source code to make it work. Iāve been dealing with phpmailer issues since Sugar, and manually changing the transfer protocol to sendmail has always worked for me. For the sake of the community (a lot of people complain about the SMTP errors), Iām going to change the code back the original and start from there. Here is the error log:
Mon Oct 23 14:36:57 2017 [28510][1][FATAL] SugarPHPMailer encountered an error: An outgoing mail server is not configured to send emails. Please configure an outgoing mail server or select an outgoing mail server for the mail account that you are using in Settings >> Mail Account.
Mon Oct 23 14:36:57 2017 [28510][1][FATAL] SugarPHPMailer encountered an error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Mon Oct 23 14:36:57 2017 [31370][-none-][FATAL] Retrieving record by id users:1 found Query Failed: SELECT users.* FROM users WHERE users.id = ā1ā AND users.deleted=0 LIMIT 0,1: MySQL error 2006: MySQL server has gone away
I have been working on these SMTP bugs this weekend. I found something that might help. The test emails from outbound accounts are getting sent with the āFromā and āFromNameā field coming from the general (system) outbound account, defined in Admin / Email settings.
If this doesnāt match the email in the outbound account youāre trying to configure, AND IF your SMTP provider gets annoyed with that, your test email wonāt send. Your actual emails might send, later, if you provide the matching āFromā and āFromNameā (on the Campaign wizard, for example).
Knowing this, you can test if this is your problem, and work around it, until some fix is made.
Letās forget the email campaign bug for now. Since I switched back to the original email.php file my test emails are not working at all.
Tue Oct 24 10:27:18 2017 [34349][1][FATAL] SugarPHPMailer encountered an error: An outgoing mail server is not configured to send emails. Please configure an outgoing mail server or select an outgoing mail server for the mail account that you are using in Settings >> Mail Account.
Tue Oct 24 10:27:18 2017 [34349][1][FATAL] SugarPHPMailer encountered an error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Iām back at the original SMTP configuration error to enable email on 1and1 servers. In Sugar, I turned on the debug mode and looked at the output and discovered I needed to be sending my email via sendmail. Suite is supposed to have corrected that bug but I still canāt send an email. Before I even worry about campaign email, I have to have this debugged. Will the email debugger be able to isolate the problem, and if so, where is it located in SuiteCRM?
This is still not capturing the full debug log as I want it to, but at least it will give you a detailed internal Exception text which is useful.
Now add this function before it, in the same file:
public function send() {
$this->phpMailerFullLog='';
$GLOBALS['log']->fatal("PHPMailer Send Function override: { FromName: $this->FromName From: $this->From Host: $$
//use these to manually override values, to test if these are the problematic parameters:
//$this->From = 'myname@mysite.com';
//$this->FromName = 'My name ';
$ret = parent::send();
$GLOBALS['log']->fatal("Internal PHPMailer Send Full debug log: { $this->phpMailerFullLog }");
return $ret;
}
Again - the full debug log is not showing, but there will be some useful extra info for you in the logs.
If you want, you can try overriding the parameters to reach acceptable values. This is just a way to test what works, and prove if the problem is really this one or not.
I inserted you function and received a PHP warning that initial segment has a syntax error in this line:
$GLOBALS[ālogā]->fatal(āInternal PHPMailer Send Full debug log: { $this->phpMailerFullLog }ā);
Since I had a backup of the original file I ran it anyway. The SMTP error did not appear, but neither did the confirmation email either. I check my inbox and there was nothing there. The resulting PHP error that was displayed is this.
Parse error: syntax error, unexpected āā (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /homepages/14/d697451344/htdocs/rtrdigital/crm/include/SugarPHPMailer.php on line 369
This error reads the same as Dreamweaver, as the line mentions above is in fact line 369 of the SugarPHPMailer file. Thoughts?
And the āsendā functions, and the variable declaration:
public $phpMailerFullLog='';
public function send() {
$GLOBALS['log']->fatal("------------ Entering SugarMailer send");
$this->phpMailerFullLog='';
//override values here if you want to easily test different arguments:
//$this->From = 'me@there.com';
//$this->Sender = 'me@there.com';
//$this->Password='wrong';
//$this->FromName = 'Me';
$GLOBALS['log']->fatal("PHPMailer Send Function override: { FromName: $this->FromName From: $this->From Host: $$
$ret = parent::send();
$line = strtok($this->phpMailerFullLog, "\n");
while ($line !== false) {
$GLOBALS['log']->fatal("smtp send: { $line }");
$line = strtok( "\n" );
}
$GLOBALS['log']->fatal("------------ Exiting SugarMailer send");
return $ret;
}
You should get a nice debug output with that. Be careful, donāt post results from that output online without first clearing the BASE64 encoded passwords that might appear in the authentication phase.
Iām going to try to run the script to see if it returns anything, but Dreamweaver typically doesnāt miss on these things. Iāll let you know how it went laterā¦