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
Warning This package relies on slm, which is abandoned and will receive no further development. For that reason, we don't recommend starting any project with this package. Instead take a look at https://github.com/omnimail/omnimail or use symfony/mailer with a 3rd Party Transport.
SlmMail is a module that integrates with various third-parties API to send mails. Integration is provided with the
API of those services. It does not handle SMTP.
Every email providers used in SlmMail allow to send HTML emails. However, by default, if you set the mail's content
using the setBody content, this content will be considered as the plain text version as shown below:
$message = new \Laminas\Mail\Message();
// This will be considered as plain text message, even if the string is valid HTML code$message->setBody('Hello world');
To send a HTML version, you must specify the body as a MimeMessage, and add the HTML version as a MIME part, as
shown below:
$message = new \Laminas\Mail\Message();
$htmlPart = new \Laminas\Mime\Part('<html><body><h1>Hello world</h1></body></html>');
$htmlPart->type = "text/html";
$textPart = new \Laminas\Mime\Part('Hello world');
$textPart->type = "text/plain";
$body = new \Laminas\Mime\Message();
$body->setParts(array($textPart, $htmlPart));
$message->setBody($body);
For accessibility purposes, you should always provide both a text and HTML version of your mails.
multipart/alternative emails with attachments
The correct way to compose an email message that contains text, html and attachments is to create a
multipart/alternative part containing the text and html parts, followed by one or more parts for the attachments. See
the Laminas Documentation
for a full example.
How to configure HttpClient with http_options and http_adapter
By default the adapter is Laminas\Http\Client\Adapter\Socket but you can override it with other adapter like this in your slm_mail.*.local.php
'slm_mail' => array(
// Here your email service provider options'http_adapter' => 'Laminas\Http\Client\Adapter\Proxy'// for example
)
If you want to change some options of your adapter please refer to you adapter class in var $config here and override these in your slm_mail.*.local.php like this :
'slm_mail' => array(
// Here your email service provider options// example for Socket adapter'http_options' => array(
'sslverifypeer' => false,
'persistent' => true,
),
)
Which provider should I choose?
We won't answer you :-)! Each provider has their own set of features. You should carefully read each website
to discover which one suits your needs best.