You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I create a new message (and send it) with: $message = $this->wire('mail')->new();
it is first send via WireSMTP module, but the HTML body is totally messed.
When I create a new message (and send it) with: $message = new WireMail();
it does not send via WireSMTP module, but the HTML body is ok.
Expected behavior
Always send with WireSMTP and well formatted body
Actual behavior
Doesn't send with WireSMTP when using new WireMail()
Messes up message body when using $this->wire('mail')->new()
Optional: Screenshots/Links that demonstrate the issue
Optional: Suggestion for a possible fix
No idea, need help
Steps to reproduce the issue
// $m = $this->wire('mail')->new(); // sends via WireSMTP, but messed body
$m = new WireMail(); // sends via mail(), but message is ok
$m->to('test@example.com');
$m->from('me@example.net');
$m->subject('Test Mail');
$m->body('Test');
$m->bodyHTML($body_html);
$m->send();
Setup/Environment
PW 3.0.98
ProcessWire version:
(Optional) PHP version: 7
(Optional) MySQL version: 5.6
(Optional) Any 3rd party modules that are installed and could be related to the issue: WireSMTP
The text was updated successfully, but these errors were encountered:
This is because with new WireMail() you are bypassing the module search that wire('mail')->new() does. new WireMail() tells php that you specifically want an object of the WireMail class, and I don't think there is any way for PW to intercept that and give you an object of a different class instead.
You can also use the wireMail() function (lowercase "w" without the new), and that will work the same way as wire('mail')->new().
Short description of the issue
When I create a new message (and send it) with:
$message = $this->wire('mail')->new();
it is first send via WireSMTP module, but the HTML body is totally messed.
When I create a new message (and send it) with:
$message = new WireMail();
it does not send via WireSMTP module, but the HTML body is ok.
Expected behavior
Always send with WireSMTP and well formatted body
Actual behavior
Doesn't send with WireSMTP when using new WireMail()
Messes up message body when using $this->wire('mail')->new()
Optional: Screenshots/Links that demonstrate the issue
Optional: Suggestion for a possible fix
No idea, need help
Steps to reproduce the issue
// $m = $this->wire('mail')->new(); // sends via WireSMTP, but messed body
$m = new WireMail(); // sends via mail(), but message is ok
$m->to('test@example.com');
$m->from('me@example.net');
$m->subject('Test Mail');
$m->body('Test');
$m->bodyHTML($body_html);
$m->send();
Setup/Environment
PW 3.0.98
The text was updated successfully, but these errors were encountered: