Available Methods for Sending Messages
The Mailer class offers two methods for sending Messages – send() and batchSend(). Each behaves in a slightly different way.
When a message is sent in Swift Mailer, the Mailer class communicates with whichever Transport class you have chosen to use (see Transport Types).
Each recipient in the message should either be accepted or rejected by the Transport. For example, if the domain name on the email address is not reachable the SMTP Transport may reject the address because it cannot process it. Whichever method you use – send() or batchSend() – Swift Mailer will return an integer indicating the number of accepted recipients.
-
Using the send() Method
The send() method of the Swift_Mailer class sends a message using exactly the same logic as your Desktop mail client would use. Just pass it a Messgae and get a result. -
Using the batchSend() Method
The batchSend() method of the Swift_Mailer class sends a separate message to each recipient in the To: field. Each recipient receives a message containing only their own address in the To: field.