Prolateral Consulting Ltd
Prolateral Consulting Ltd
Knowledgebase: outmail
How do I set up outbound SMTP using PHPMailer?


How do I set up outbound SMTP using PHPMailer?
How do I use outMail in PHP?


The following example of code assumes you have already got a fully functional webserver and the PHPMailer Classes Installed (see )

Example code outmail-phpmailer.php

	require_once("class.phpmailer.php" );
	$mail = new PHPMailer(true);    // the true param throws exceptions that we need to catch
	$mail->IsSMTP();             // telling the class to use SMTP
	try {
		// Enables SMTP debug information (for testing)
		//    1 = errors and messages
		//    2 = messages only
		$mail->SMTPDebug = 1;                    

		// Enable SMTP authentication
		$mail->SMTPAuth = true;
		// SMTP server
		$mail->Host = "";   

		// set the SMTP port for the outMail server        
		//    use either 25, 587, 2525 or 8025
		$mail->Port = 25;

		// outMail username        
		$mail->Username = "username";
		// outMail password
		$mail->Password = "password";
		// Message details
		$mail->AddReplyTo('', 'First Last');
		$mail->AddAddress('sender@there-domain.local', 'First Last');
		$mail->SetFrom('', 'First Last');
		$mail->Subject = 'PHPMailer Test using outMail';
		$mail->AltBody = 'Text Message goes here.';
		$mail->MsgHTML('HTML Message goes here.');
		// Send the Message
		echo "Message Sent OK</p>\n";
	catch (phpmailerException $e){echo $e->errorMessage();} //Pretty error msg from PHPMailer
	catch (Exception $e){echo $e->getMessage();} //Boring error messages from anything else!

Summary of server details

Outgoing server

As provided in your signup email.

Outgoing server protocol


Outgoing server port

25, 587, 2525 or 8025

Authentication Type

Basic Authentication


As provided


As provided


(145 vote(s))
Not helpful

The Origin of this information may be internal or external to Prolateral Consulting Ltd. Prolateral makes all reasonable efforts to verify this information. However, the information provided in this document is for your information only. Prolateral makes no explicit or implied claims to the validity of this information. Any trademarks referenced in this document are the property of their respective owners.