vae_template_mail()

The vae_template_mail() function sends an E-Mail in both text and HTML format, using HTML or Haml or PHP templates that work the same way templates work for Store mails.

To support users who disable HTML in their email client, you should create two files for the template: one HTML and one plain text. Users who disable HTML on their email clients will see the plain text version, while everyone else will see the HTML email.

Name the text version .txt.html (or .txt.php), and name the HTML version with a standard extension (such as .haml, .html, or .php).

Usage

vae_template_mail($from, $to, $subject, $template, $text_yield, $html_yield, $headers = null)

  • $from - E-Mail address that will be the From address in the E-Mail. You may specify a name here as well by using the standard E-Mail formatting: John Doe <[email protected]>.

  • $to - E-Mail address that the E-Mail will be sent to. You may specify multiple E-Mail addresses delimited by commas.

  • $subject - Subject of the E-Mail.

  • $template - filename of the template, relative to your document root. You may omit the extension here.

  • $text_yield - If your template contains a <v:yield /> tag, its contents will be replaced by this data for the text version of your email.

  • $html_yield - If your template contains a <v:yield /> tag, its contents will be replaced by this data for the HTML version of your email.

  • $headers - Optional newline-delimited string of additional headers.

Returns

Returns true.

Sample Usage

<?php
// Send Welcome E-Mail
vae_template_mail("My Website <[email protected]>", $email_address, "Welcome to My Website", "/emails/welcome");
?>