New module type: WireMail

57 posts in this topic

Exactly. How you log things is up to you, but for debugging purposes it's totally valid to edit core files. Just revert back to original state after you've found your issue.

Thanks. I feel silly now: I should have consulted my Postfix logs.

I did:

journalctl --since "20 min ago"

I noticed: status=bounced (SMTPUTF8 is required, but was not offered by host..

So I did a web search and ran this config command:

postconf -e smtputf8_enable=no

Now the mail is sent! :lol:

I had already tested the dumping inside WireMail.php.. I'll leave info about it below for future generations.

if($toName) $to = $this->bundleEmailAndName($to, $toName); // bundle to "User Name <user@example.com"
die(var_dump($to, $this->subject, $body, $header, $param));
if(@mail($to, $this->subject, $body, $header, $param)) $numSent++;

Header was like this:

From: user@mysite.com X-Mailer: ProcessWire/WireMail Content-Type: text/plain; charset="utf-8"

3 people like this

Share this post

Link to post
Share on other sites

I've had problems sending HTML email.
It appears some php configurations don't like \r\n (*nix). This has come up on more than one occasion on dedicated hosting environments.

I've had to modify WireMail.php to send HTML email correctly.

		 if($this->bodyHTML) {
			if(!strlen($text)) $text = strip_tags($html); 
			$boundary = "==Multipart_Boundary_x" . md5(time()) . "x";
			$header .= PHP_EOL."MIME-Version: 1.0";
			$header .= PHP_EOL."Content-Type: multipart/alternative; ".PHP_EOL." boundary=\"$boundary\"";
			$body = "This is a multi-part message in MIME format." .PHP_EOL.PHP_EOL. 
				"--$boundary" . PHP_EOL . 
				"Content-Type: text/plain; charset=\"utf-8\"" .PHP_EOL . 
				"Content-Transfer-Encoding: 7bit" .PHP_EOL.PHP_EOL. 
				"$text" .PHP_EOL.PHP_EOL. 
				"--$boundary". PHP_EOL . 
				"Content-Type: text/html; charset=\"utf-8\"".PHP_EOL . 
				"Content-Transfer-Encoding: 7bit".PHP_EOL.PHP_EOL . 
				"$html" .PHP_EOL.PHP_EOL . 
				"--$boundary--". PHP_EOL;
		} else {
			$header .= PHP_EOL."Content-Type: text/plain; charset=\"utf-8\""; 
			$body = $text; 

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.