Difference between revisions of "Email Templates"

From WHMCS Documentation

(Adding an Attachment)
Line 8: Line 8:
  
 
==Adding an Attachment==
 
==Adding an Attachment==
If you wish to add an attachment to an email, open the file includes/class.phpmailer.php and on line 390, add:
+
A number of users have asked us how they can add attachments to email templates by default. While we haven't yet implemented support for this natively, you can do it from within the code. To do this, open the file includes/class.phpmailer.php and on line 390, add:
  
  if ($this->Subject=="Hosting Account Welcome") $this->AddAttachment("/home/username/filename.pdf");  
+
  if ($this->Subject=="Hosting Account Welcome")
 +
  $this->AddAttachment("/home/username/filename.pdf");  
  
 
Change the subject value and filepath as appropriate for the file you want to send and the appropriate email to send it with, save and then upload. You can add multiple instances of the line if required.
 
Change the subject value and filepath as appropriate for the file you want to send and the appropriate email to send it with, save and then upload. You can add multiple instances of the line if required.

Revision as of 01:15, 9 February 2010

The email templates allow you to customise the messages that go out to your customers when actions occur inside WHMCS. Every email that goes out to a customer can be customised here.

To edit an email template, go to Setup > Email Templates and click the edit icon next to the template you want to change.

You can also toggle plain text vs. HTML email sending on a per email basis from the editor page.

A list of the data fields available to you when composing an email are shown below the editor. The merge fields you can use depend upon what the email is related to and so you can't always use the fields from one template in another - only those of the same group.

Adding an Attachment

A number of users have asked us how they can add attachments to email templates by default. While we haven't yet implemented support for this natively, you can do it from within the code. To do this, open the file includes/class.phpmailer.php and on line 390, add:

if ($this->Subject=="Hosting Account Welcome")
  $this->AddAttachment("/home/username/filename.pdf"); 

Change the subject value and filepath as appropriate for the file you want to send and the appropriate email to send it with, save and then upload. You can add multiple instances of the line if required.