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.
Configure OTP emails with Email API for PHP
OTP emails is an important component of any email communication strategy. In order to ensure delivery of OTP emails to your customers, reply on a trusted cloud-based email provider like Mailazy as a partner in your growth journey.
Configure Email API with PHP
The Mailazy platform helps you to send transactional emails seamlessly and track email deliverability and enables your applications to send messages via a simple HTTP REST interface. When you sign up for a free Mailazy account, you'll be able to send 350 emails per day forever. For more account options, see our pricing page.
Mailazy has recently released a PHP library that will allow you to send email from Mailazy email API. This library gives you full access to all of the features offered by our PHP Email API. APIs, in general, have better delivery speeds and can be executed in less than a second.
This doesn’t mean that sending email using SMTP is going to be slow, but API has less back and forth and reduces the potential steps for failure when sending an email.
The Mailazy PHP library has cURL or FSOCKOPEN dependencies.
It is easy to build, customize, and send emails, including email messages with to, from, cc, bcc, reply_to, attachments, and custom headers.
The library also has a ton of pre-written code examples to demonstrate more advanced topics like sending bulk mail, merge data, and other features.
You need to complete these given prerequisites, you can skip the step if you have already completed.
Sign up for a Mailazy account.
Complete Domain Authentication.
Generate the Mailazy Access Key
PHP installed and configured
Integration with PHP
Create a PHP demo project via Initialize composer.
Create a php file to setup a demo mailazy sending project with name
Install the mailazy package via composer, simple type the following in your terminal:
composer require mailazy/php-sdk
Start Sending mail using the code provided below in the
define('MAILAZY_APIKEY','xxxxxxxxxxxxxxxxxxxxxxxx');// mailazy apikey replace at "MAILAZY_APIKEY" define('MAILAZY_APISECRET','xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');// mailazy apikey replace at "MAILAZY_APISECRET" require 'vendor/autoload.php'; $mailazyClient = new mailazyAPI(); $mailazyClient->setApikey(MAILAZY_APIKEY); $mailazyClient->setApisecret(MAILAZY_APISECRET); $mailazyClient->isHTML(true); $mailazyClient->addAddress($email,$userName); //Set CC address $mailazyClient->addCC($email,$userName); //Set BCC address $mailazyClient->addBCC($email,$userName); $mailazyClient->setSubject($subject); $mailazyClient->setBody($message); $mailazyClient->setFrom($senderEmail,$sendername); $mailazyClient->addReplyTo($replyEmail,$replyname); $mailazyClient->addAttachment($filePath); $mailazyClient->send();
Update Mailazy credentials with your Mailazy Account in above code.
index.phpfile and hit project URL
Now you will get email at your provided receipt email address.
To enable error reporting in php add the following line of code in
index.phpfile at top.
ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);
API error codes: https://mailazy.com/docs/api/error-codes/
Send Emails with Mailazy
Mailazy is a simple email service to use, yet it provides so many benefits. Mailazy is the only simple transactional email service you’ll need. And the forever free plan lets you test drive it., Mailazy's team is well-equipped to help you quickly resolve your queries and issues. Try us for free today!Signup for Free Developer Documentation
Ready to get started?
For High-Volume custom requirements send us an email and we will come up with a detailed quote within 24 hours.Contact Us