gdmaq_mail_to_queue($args = array())
This function adds a new email to the mail queue. A list of arguments contains the ‘type’ argument. This is usually detected by the plugin, but when passed by this function it can be anything. Check out this article for list of email types normally detected by the plugin:
Extras array contains extra parameters from the PHPMailer class, and attachments are the array with attachments defined by the full path to the file. Headers array contains a list of headers, each one is defined as an array containing two values: the name of the header and value.
- $args: array definition of the email to add to queue
- to: one or more email addresses to send emails to.
- from: email of the email sender
- subject: email subject
- plain: plain text version of the email
- html: full HTML version of the email
- type: type of email, default: mail.
- headers: array with additional headers to include
- attachments: array with files to attach
- extras: array with additional parameters
If you want to send an email to more than one recipient, use the array for the ‘to’ value. Both ‘to’ and ‘from’ can be set to email only, but they can also contain name and email.
Here is the basic example of adding an email into the queue.
gdmaq_mail_to_queue(array( 'to' => 'firstname.lastname@example.org', 'subject' => 'This is just a test email', 'plain' => 'This is the email body...' ));
Here is the example of adding an email into the queue for sending to 2 different emails. It also set’s from email.
gdmaq_mail_to_queue(array( 'to' => array( 'email@example.com', array('firstname.lastname@example.org', 'Example Name') ), 'from' => 'email@example.com, 'subject' => 'This is just a test email', 'plain' => 'This is the email body...' ));