For Developers By Developers

You can integrate Mailazy in minutes with your platform. Build and monitor your email solution on a trusted foundation with technical and strategic support when you need it the most.

Trusted by 120+ partners and delivering over 650 Million emails/month

Configure Subscription renewal emails with SMTP for CakePHP

Subscription renewal emails is an important component of any email communication strategy. In order to ensure delivery of Subscription renewal emails to your customers, reply on a trusted cloud-based email provider like Mailazy as a partner in your growth journey.

Prerequisites

You need to complete these given prerequisites, you can skip the step if you have already completed.

  1. Sign up for a Mailazy account.

  2. Complete Domain Authentication.

  3. Generate the Mailazy Access Key

Integrate Mailazy with CakePHP

CakePHP comes with an email library that supports SMTP. You can check CakePHP documentation page for more details. We have developed an example that shows how to send an email with both HTML and text bodies.

In app/views/layouts/ you need to define the layout of your text and HTML emails:

email/
html/
default.ctp
text/
default.ctp

In app/views/layouts/email/text/default.ctp add:

< ?php echo  $content_for_layout; ?>

and in app/views/layouts/email/html/default.ctp add:

< ?php echo  $content_for_layout; ?>

Then create the template for your emails.

In this example we created templates for a Login email with the following structure:

app/
views/
elements/
email/
text/
registration.ctp
html/
registration.ctp

In app/views/elements/email/text/registration.ctp add:

Dear < ?php echo $name ?>,

Thank you for Login. Please go to http://domain.com to finish your registration.

and in app/views/layouts/email/html/default.ctp add:

Dear < ?php echo $name ?>,

Thank you for registering. Please go to here to finish your registration.

In your controller enable the email component:

< ?php var $components = array('Email'); ?>

Then anywhere in your controller you can do something like the following to send an email: (make sure to replace your own access_key / access_secret details, better to make them constant)

$this->Email->smtpOptions  =  array(
  'port'=>'587',
  'timeout'=>'30',
  'host' => 'smtp.mailazy.com',
  'username'=>'access_key',
  'password'=>'access_secret'
);

$this->Email->delivery  = 'smtp';
$this->Email->from  = 'Your Name ';
$this->Email->to  = 'Recipient Name ';
$this->set('name', 'Recipient Name');
$this->Email->subject  = 'This is a subject';
$this->Email->template  = 'Login';
$this->Email->sendAs  = 'both';
$this->Email->send();

Send transactional emails with Mailazy

Mailazy email delivery platform is powered by AI and uses the global infrastructure so that you can scale effortlessly. Mailazy is the trusted transactional email provider for hundreds of businesses and we are growing every day. We are known for being the most reliable and trusted senders on the internet.

Ready to get started?

Get started — it's free