Jump to content

Smtp Mail Logging Doesn't Work


Alex

Recommended Posts

I reported this to Paul a while back, but haven't had time to get it on the forums until now.

 

Whenever we use SMTP for outgoing mail in Blesta (have tried 3 different servers) we do not get any mail logging of the content. However, if we use PHP piping for outgoing mail, the log works just fine. I have attached some screenshots displaying the problem while using the Rackspace mail servers.

 

Just to be clear, SMTP mail logging has never worked for us at any point, this is not something that "broke"

post-538-0-63414900-1380814311_thumb.png

post-538-0-77452900-1380814316_thumb.png

Link to comment
Share on other sites

Looks like it's logging just fine, based on your second screenshot. To confirm, check the log_mail table for entries.

 

I believe the issue you're seeing is that only plain-text versions of emails are displayed in the UI, and it looks like you have no plain-text versions of your emails. Blesta should automatically convert your HTML emails to plain-text when delivered, but if the plain-text email template contains anything (including white space) that would prevent the automatic conversion from taking place.

Link to comment
Share on other sites

Looks like it's logging just fine, based on your second screenshot. To confirm, check the log_mail table for entries.

 

I believe the issue you're seeing is that only plain-text versions of emails are displayed in the UI, and it looks like you have no plain-text versions of your emails. Blesta should automatically convert your HTML emails to plain-text when delivered, but if the plain-text email template contains anything (including white space) that would prevent the automatic conversion from taking place.

 

Logging just fine? Logging without content. We have no HTML emails, all we use is plain text. The HTML tab is empty for all of the templates, there is only content in the Text tab. Also, as I said, it works fine with PHP piping without changing the templates.

Link to comment
Share on other sites

Logging just fine? Logging without content. We have no HTML emails, all we use is plain text. The HTML tab is empty for all of the templates, there is only content in the Text tab. Also, as I said, it works fine with PHP piping without changing the templates.

 

In that case,

 

Include your configuration settings, i.e. OS, version of Blesta, PHP & MySQL.

Link to comment
Share on other sites

CORE-795 is fixed for 3.0.4. To patch yourself update /components/email/email.php lines 260-276:

 

from:

 

        $body_text = null;
        foreach ($this->message->getChildren() as $child) {
            if ($child->getContentType() == "text/plain")
                $body_text = $child->getBody();
        }
        
        $vars = array_merge($vars,
            array(
                'to_address'=>implode(',', array_keys((array)$this->message->getTo())),
                'from_address'=>implode(',', array_keys((array)$this->message->getFrom())),
                'from_name'=>implode(',', array_values((array)$this->message->getFrom())),
                'cc_address'=>$cc_address,
                'subject'=>$this->message->getSubject(),
                'body_text'=>($body_text),
                'body_html'=>($this->message->getContentType() != 'text/plain' ? $this->message->getBody() : null)
            )
        );

 

to:

 

        $body_text = null;
        $body_html = null;
        foreach ($this->message->getChildren() as $child) {
            if ($child->getContentType() == "text/plain")
                $body_text = $child->getBody();
        }
        if ($body_text === null)
            $body_text = $this->message->getBody();
        else
            $body_html = $this->message->getBody();
        
        $vars = array_merge($vars,
            array(
                'to_address'=>implode(',', array_keys((array)$this->message->getTo())),
                'from_address'=>implode(',', array_keys((array)$this->message->getFrom())),
                'from_name'=>implode(',', array_values((array)$this->message->getFrom())),
                'cc_address'=>$cc_address,
                'subject'=>$this->message->getSubject(),
                'body_text'=>$body_text,
                'body_html'=>$body_html
            )
        );
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...