Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Predefined actions

PHPrunner32x32     PHPRunner manual


Send simple email

Scroll Prev Next More

 

Send simple email action allows sending an email from one email address to another.

 
You can edit several parameters: the text and the subject of the message, the sender and recipient email addresses. You can also attach files of any format supported by your email service provider.

 

This action is available at any event except JavaScript onload events.

send_simple_email_select_action

 

Note: To use this action, you have to set up the Email settings. Press this button hmfile_hash_34fe252e on the toolbar or write the code manually.

 

Change red values to adjust the action code to your project.

 

// ********** Send simple email ************
$email="test@test.com";
$from="admin@test.com";
$msg="Hello there\nBest regards";
$subject="Sample subject";
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));
if(!$ret["mailed"])
  echo $ret["message"];

 

You can send HTML emails as well:

 

Note: Assign HTML code to your $msg variable and replace the 'body' key with 'htmlbody' key.

 

// ********** Send HTML email ************
$email="test@test.com";
$from="admin@test.com";
$msg="<b>Hello there</b><br>Best regards";
$subject="Sample subject";
$attachments = array();
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'htmlbody' => $msg, 'from'=>$from, 'attachments' => $attachments));

 

To learn how to customize email templates, see Registration and passwords: Email templates.

See also:

runner_mail function

Send mass email to all users

Send an email with attachment

Send an email to selected users

Send email with new data

Send email with old data

Email selected records

How to email selected records as separate PDF files