Knowledgebase: outmail
How do I set up outbound SMTP using CakePHP?

Problem:

How do I set up outbound SMTP using CakePHP?
How do I set up outbound SMTP using the email component from CakePHP?
How do I use outMail in CakePHP?
How do I use outMail with the email component from CakePHP?

Solution:

The following example of code assumes you have already got a fully functional webserver and the CakePHP framework installed and working.

Example code outmail-cakephp.php

<?php

	public $default = array(
	    'host' => 'mxXXXXXX.smtp-engine.com',
	    'port' => 25,
	    'auth' => 'plain',
	    'username' => 'outmail_username',
	    'password' => '**********',
	    'tsl' => false,
	    'transport' => 'smtp',
	    'from' => array('me@example.com' => 'Username'),
	    'returnPath' => 'me@example.com',
	    'layout' => false,
	    'emailFormat' => 'html',
	    'template' => 'only_text',
	    'charset' => 'utf-8',
	    'headerCharset' => 'utf-8',
	);

	$this->Email->to = 'Name <toaddress@example.com>';
	$this->Email->subject = 'Subject goes here...';
	$this->Email->from = 'My Name <me@example.com>';
	$this->Email->template = 'user_confirm';
	$this->Email->sendAs = 'html';
	$this->Email->smtpOptions = $default;
	$this->Email->delivery = 'smtp';

	if ($this->Email->send()) {
		return true;
	} else {
		echo $this->Email->smtpError;
	}
   
?>

Summary of server details

Outgoing server

mxXXXXXX.smtp-engine.com

As provided in your signup email.

Outgoing server protocol

SMTP

Outgoing server port

25, 587, 2525 or 8025

Authentication Type

Basic Authentication

Username

As provided

Password

As provided

 

(2 vote(s))
Helpful
Not helpful





Disclaimer
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.