A simple PHP email class
It uses PHP's mail()
function. There is also a possibility to attach file.
First of all, you need to include it:
include_once( 'ReMail.class.php' );
Here is an example how to setup and send mail:
$mail = new ReMail( );
$mail->setFrom( 'Alice <[email protected]>' );
$mail->addTo( '[email protected]' );
$mail->setSubject( 'The Rabbit Hole' );
$mail->setMessage( 'I am coming, dear Hatter!' );
$mail->addAttachment( '/path/to/RabbitHole.jpg' );
$mail->send( );
Info: This method adds an attachment(s) to the mail
Arguments:
- Attachment file(s)
- Type: String or Array of strings
- Value - should be absolute or relative path, that PHP engine will parse correctly
- Type of the file(s)
- Type: String
- Value - should be "inline" or "attachment" - in fact, this parameter is used only from another function - to provide the source for HTML images in the message. Not tested for user manipulation.
Return: N/A
Info: This method sets the mail message
Arguments:
- The message
- Type: String
- Value - should be text message
Return: N/A
Info: This method adds an email(s) to BCC section
Arguments:
- Email(s)
- Type: String or Array of strings
- Value - should be valid email address(es)
Return: N/A
Info: This method adds an email(s) to CC section
Arguments:
- Email(s)
- Type: String or Array of strings
- Value - should be valid email address(es)
Return: N/A
Info: This method adds an email(s) to To section
Arguments:
- Email(s)
- Type: String or Array of strings
- Value - should be valid email address(es)
Return: N/A
Info: This method adds an email(s) to Reply-To section
Arguments:
- Email(s)
- Type: String or Array of strings
- Value - should be valid email address(es)
Return: N/A
Info: This method set the name/email of the sender
Arguments:
- Sender
- Type: String
- Value - should be text
Return: N/A
Info: This method set the subject of the conversation
Arguments:
- Subject
- Type: String
- Value - should be text
Return: N/A
Info: This method sends the email conversation
Arguments: N/A
Return: true
for success, 'no-valid-emails'
- if the object hasn't been provided with an email addresses or other value in rest cases