This topic is locked
[SOLVED]

 How to send simple email after record is added

5/21/2017 4:04:27 PM
PHPRunner General questions
John Rotella author

I want to notify myself when someone adds or updates a record.

I am on ADD page After Record Added. I use this code
$email="john@johnrotella.com";

$from="john@tbird.info";

$msg="Sample Message";

$subject="Sample subject";

$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];

My SMTP is correct because I get notifications when someone registers. I followed the instructions in the manual and used the code from the + sign on Select Action.

Is there some line I am missing?

Please tell me my mistake thank you.

T
Tempus_Erus 5/21/2017



I want to notify myself when someone adds or updates a record.

I am on ADD page After Record Added. I use this code
$email="john@johnrotella.com";

$from="john@tbird.info";

$msg="Sample Message";

$subject="Sample subject";

$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];

My SMTP is correct because I get notifications when someone registers. I followed the instructions in the manual and used the code from the + sign on Select Action.

Is there some line I am missing?

Please tell me my mistake thank you.


Not sure about the runner mail array, but using PHPs mail function may help....
$to = 'nobody@example.com';

$subject = 'the subject';

$message = 'hello';

$headers = 'From: webmaster@example.com' . "\r\n" .

'Reply-To: webmaster@example.com' . "\r\n" .

'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);

John Rotella author 5/21/2017



Not sure about the runner mail array, but using PHPs mail function may help....
$to = 'nobody@example.com';

$subject = 'the subject';

$message = 'hello';

$headers = 'From: webmaster@example.com' . "\r\n" .

'Reply-To: webmaster@example.com' . "\r\n" .

'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);



THANK YOU I will try it.

John Rotella author 5/21/2017



THANK YOU I will try it.


No that doesn't work either. I am perplexed because I use the PHP Runner format exactly as written in the help manual.

John Rotella author 5/22/2017



No that doesn't work either. I am perplexed because I use the PHP Runner format exactly as written in the help manual.



After dozens of tries I finally cleared the entire output folder, got a totally fresh output, and that worked. My experience with PHP R is limited so I don't know why, but it worked.