Description
Build and send an email with fields substituted by default
Usage
$bool = oiku_send_email( $email, $subject, $message, $headers, $fields );Parameters
- ( string ) required – email address of the recipient – overridden by the value in $fields['email']
- $subject
- ( string ) optional – the one line email subject, excluding Subject:
- $message
- ( string ) optional – the body of the email
- $headers
- ( array/string ) optional – the message header: From:, Bcc:, Content-type: etc
- $fields
- ( array ) optional – name value pairs for symbolic substitution
Returns
bool the result of the wp_mail() callSource
File name: oik-user/includes/oik-user-email.incLines:
1 to 13 of 13
function oiku_send_email( $email, $subject=null, $message=null, $headers=null, $fields=array() ) { $to = bw_array_get( $fields, 'oiku_email_to', $email ); $headers = oiku_get_email_headers( $headers, $fields ); $subject = oiku_get_email_subject( $subject, $fields ); $message = oiku_get_email_message( $message, $fields ); $attachments = null; $result = wp_mail( $to, $subject, $message, $headers, $attachments ); bw_trace2( $result, "result of wp_mail" ); if ( !$result ) { p( "Failed to send email to: $to subject: $subject " ); } return( $result ); }View on GitHub
Invoked by
Calls
1 to 6 of 6
- bw_array_get() – Return the array[index] or array->index (for an object) or a default value if not set
- bw_trace2() – Trace $value to the trace log file if tracing is active
- oiku_get_email_headers() – Set the email headers for the wp_mail() call
- oiku_get_email_message() – Build the email message
- oiku_get_email_subject() – Return the subject of the email
- p() – Output a paragraph of translatable text
