PHP code example of anthonybudd / wp_mail
1. Go to this page and download the library: Download anthonybudd/wp_mail library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
anthonybudd / wp_mail example snippets
$email = WP_Mail::init()
->to('[email protected] ')
->subject('WP_Mail is great!')
->template(get_template_directory() .'/emails/demo.php', [
'name' => 'Anthony Budd',
'location' => 'London',
'skills' => [
'PHP',
'AWS',
]
])
->send();
$email = WP_Mail::init()
->to([
'[email protected] '
'[email protected] '
])
->cc('[email protected] ')
$email = WP_Mail::init()
->subject('This this the subject')
$email = WP_Mail::init()
->from('John Doe <[email protected] >')
$email = WP_Mail::init()
->attach(ABSPATH .'wp-content/uploads/2017/06/file.pdf')
$email = WP_Mail::init()
->template(get_template_directory() .'/email.html', [
'name' => 'Anthony Budd',
'job' => 'Developer',
])
$email = (new WP_Mail)
->beforeTemplate(get_template_directory() .'/email-header.html')
->afterTemplate(get_template_directory() .'/email-footer.html')
->template(get_template_directory() .'/email.html', [
'name' => 'Anthony Budd',
'job' => 'Developer',
])
$email = WP_Mail::init()
->headers("From: John Doe <[email protected] >")
$email = WP_Mail::init()
->headers([
"From: John Doe <[email protected] >",
"X-Mailer: PHP/". phpversion(),
"Reply-To: [email protected] ",
"Content-type: text/html; charset=iso-8859-1",
])
$email = (new WP_Mail)
->send()