PHP Classes

File: examples/

Recommend this page to a friend!
  Classes of Christian Vigh   PHP Mail Sending   examples/   Download  
File: examples/
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: PHP Mail Sending
Send HTML email messages with attachments
Author: By
Last change: Update of examples/
Date: 1 year ago
Size: 1,493 bytes


Class file image Download



This is the main include file for all the example. You will have to redefine two variables here before trying to run the examples :

  • $recipient (mandatory) : each example script is sending an email to a recipient. This is the variable used for that, so redefine it to specify your own email address.
  • $sender (optional) : the sender's email address, which can be a completely invented address. Specify false if you want to use the sendmail_from setting from your php.ini file.

Directory data/

Contains files that are used as attachments by the attachments.Php example script.

Directory Images/

Contains two images that are embedded in the html contents of several example scripts.

File mail.html

Html file that contains mail contents used by the external-html.php example script.

Example scripts


Sends an email with only a text part (no html contents).


Sends an email with both text and html parts.


Sends an email containing embedded images. Html contents are given by a string.


Sends an email whose html contents come from an external file, mail.html. The html contents reference two embedded images.


Sends an email with embedded images and attachments (coming from the data/ directory).