skip to Main Content

Use with phpMailer

phpMailer is a PHP class widely used to send emails from a website.

It makes it easy to understand things a little more complex such as sending attachments, encodings, etc.

You can use your account with phpMailer based on the following source code:


require ("class.phpmailer.php");

$mail - new PHPMailer();

$mail->IsSMTP(); telling the class to use SMTP
$mail->Host - ""; to replace with the server assigned to you
$mail->Port - 587;
$mail->SMTPAuth - true;
$mail->Username - ''; to replace with the SMTP login that was provided to you
$mail->Password - 'Password'; to replace with the SMTP password that was provided to you
The sequel is to be customized according to what you want to do.
Here's an example to send a simple email in text format

$mail->From - ""; 
$mail->AddAddress (""); 
$mail->Subject - "First PHPMailer Message"; 
$mail->Body - "Hi! This is my first email sent through PHPMailer."; 
$mail->WordWrap - 50; 
 echo 'Message was not felt.'; 
 echo 'Mailer error: ' . $mail->ErrorInfo; 
 echo 'Message has been felt.'; 
Back To Top