Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laminas Mail Laravel Package

oroinc/laminas-mail

oroinc/laminas-mail is a small bridge package for using Laminas Mail components within Oro applications. Provides the Laminas mail classes and configuration needed to send emails, manage transports, and integrate with Oro’s mailing features.

View on GitHub
Deep Wiki
Context7

Introduction

laminas-mail provides generalized functionality to compose and send both text and MIME-compliant multipart email messages. Mail can be sent with laminas-mail via any of the Sendmail, SMTP, or file-based transports it defines. You can also implement your own transport by implementing the Laminas\Mail\Transport\TransportInterface.

Basic email

A basic email consists of one or more recipients, a subject, a body and a sender. To send such a mail using Laminas\Mail\Transport\Sendmail, do the following:

use Laminas\Mail;

$mail = new Mail\Message();
$mail->setBody('This is the text of the email.');
$mail->setFrom('Freeaqingme@example.org', "Sender's name");
$mail->addTo('Matthew@example.com', 'Name of recipient');
$mail->setSubject('TestSubject');

$transport = new Mail\Transport\Sendmail();
$transport->send($mail);

Minimum definitions

In order to send an email using laminas-mail you have to specify at least one recipient as well as a message body. Please note that each transport may require additional parameters to be set.

For most mail attributes there are "get" methods to read the information stored in the message object. for further details, please refer to the API documentation.

Configuring the default sendmail transport

The default transport is Laminas\Mail\Transport\Sendmail. It is a wrapper to the PHP mail() function. If you wish to pass additional parameters to the mail() function, create a new transport instance and pass your parameters to the constructor.

Passing additional mail() parameters

This example shows how to change the Return-Path of the mail() function.

use Laminas\Mail;

$mail = new Mail\Message();
$mail->setBody('This is the text of the email.');
$mail->setFrom('Freeaqingme@example.org', 'Dolf');
$mail->addTo('matthew@example.com', 'Matthew');
$mail->setSubject('TestSubject');

$transport = new Mail\Transport\Sendmail('-freturn_to_me@example.com');
$transport->send($mail);

Chose your transport wisely

Although the sendmail transport is the transport that requires least configuration, it may not be suitable for your production environment. This is because emails sent using the sendmail transport will be more often delivered to SPAM-boxes. This can partly be remedied by using the SMTP Transport combined with an SMTP server that has an overall good reputation. Additionally, techniques such as SPF and DKIM may be employed to ensure even more email messages are delivered successfully.

Warning: Sendmail Transport and Windows

As the PHP manual states, the mail() function has different behaviour on Windows than it does on *nix based systems. Using the sendmail transport on Windows will not work in combination with addBcc(). The mail() function will send to the BCC recipient such that all the other recipients can see that address as the recipient!

Therefore if you want to use BCC on a windows server, use the SMTP transport for sending!

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky