Start a new topic

Send email from php


What is the recommended way for sending emails from PHP code, using the template system.  I'm working on a customisation where I'll have a cron job checking for certain conditions in the database on a regular basis and I'd like to be able to send emails to customers from the PHP code.  Is it possible to use the email template functionality for this?  Can I write the code in PHP to check the condition and then make an API call to the BD platform to send the email?

Many thanks,

1 person has this question

Did you ever manage to achieve this?

Yes, I built my own email and templating system.

I can help you with this if you like.

I'm thinking of trying to writer something or even use the email engine from my current website. Any guidance you have is appreciated.

Hi, what's your email address?  I'll drop you a PM.

Hi Jonny - you can contact me at



I think that most script sending templates can be found. I will only say that when sending to multiple recipients, it's best to use the Bcc header: which sends a copy of the message to the specified email (taking from my college homework):

$to = ""; 
$subject = "Checking the sending letters"; 
$message = "Hi!
Mail robot"; 
// message text
$mailheaders = "Content-type:text/plain;charset=utf-8"; 
$mailheaders .= "From: SiteRobot <>"; 
$mailheaders .= "Reply-To:"; 
$mailheaders .= "Bcc:"; 
$mailheaders .= "Bcc:"; 
$mailheaders .= "Bcc:"; 
mail($to, $subject, $message, $mailheaders);
// send letter

Login or Signup to post a comment