For anyone else facing this issue or similar, I’ve put together a temporary piece of code for myself, the following piece of code assumes the email is formatted in HTML and not just plain text, but should work both ways.
Additionally, there is probably a better way to do this, like a function, but here goes:
global $wpdb;
$queue_table_name = $wpdb->prefix . 'gdmaq_queue';
$wpdb->insert(
$queue_table_name,
array(
'blog_id' => '1',
'status' => 'queue', // this adds the email to the queue list
'queued' => $date, // current date formatted like: $date = date("Y-m-d H:i:s");
'sent' => '0000-00-00 00:00:0', // blank date that will be changed once the queued email has been send
'type' => 'mail',
'to_email' => $receivingemail, // variable for your too address
'subject' => $subject, // variable for your subject
'plain' => '',
'html' => $body, // the email content
'headers' => '[]',
'attachments' => '[]',
'extras' => '{"CharSet":"UTF-8","ContentType":"text\/html","Encoding":"8bit","From":"[email protected]","FromName":"FromName"}', // Header information, this changes the from email address and from name.
'message' => '',
)
);
I’ve put this in-place of the wp_mail(); function. This adds all the info to the queue database and it will be sent on the next queue run.
This is currently working for me in a custom built plugin.
As stated, there’s probably a better method like a function but I’ve yet to find it.
-
This reply was modified 5 years, 5 months ago by Eddie.