This topic is locked
[SOLVED]

 runner_mail() fails with "invalid address"

7/8/2018 4:25:14 PM
PHPRunner General questions
R
RockyMtnHi author

Running the code below results in an "invalid address" error and the email address is valid. I am running it in the After record updated event, AfterEdit() function.
Any ideas why this would happen?
Thanks for the help.
==============
$email = "michael@wildbluepress.com";

$subject = "[WBP] New Title Added";

$message = "The title - TEST TITLE has been signed.";

$arr = runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $message));
// if error happened print a message on the web page

if (!$arr["mailed"]) {

echo "Error happened:
";

echo $arr["message"];

}

lefty 7/8/2018



Running the code below results in an "invalid address" error and the email address is valid. I am running it in the After record updated event, AfterEdit() function.
Any ideas why this would happen?
Thanks for the help.
==============
$email = "michael@wildbluepress.com";

$subject = "[WBP] New Title Added";

$message = "The title - TEST TITLE has been signed.";

$arr = runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $message));
// if error happened print a message on the web page

if (!$arr["mailed"]) {

echo "Error happened:
";

echo $arr["message"];

}


Does this event work on after add? It looks fine. The only thing I see which should not effect it is the string in subject [ ] brackets. I am not sure if phprunner auto escaped them , but I believe phprunner does for the subject as the quotes should . Are you getting error message in phprunner or are you just not getting the email? Not sure what version you are using but
try for email errors from help file
[color=#0000FF]if (!)
{
[color=#0000FF] echo ;
[color=#0000FF] echo ;
[color=#0000FF] echo ;
[color=#0000FF] echo "
";

R
RockyMtnHi author 7/9/2018



Does this event work on after add? It looks fine. The only thing I see which should not effect it is the string in subject [ ] brackets. I am not sure if phprunner auto escaped them , but I believe phprunner does for the subject as the quotes should . Are you getting error message in phprunner or are you just not getting the email? Not sure what version you are using but
try for email errors from help file
[color=#0000FF]if (!)
{
[color=#0000FF] echo ;
[color=#0000FF] echo ;
[color=#0000FF] echo ;
[color=#0000FF] echo "
";


======================

I added that code and removed the brackets. The email didn't go out. This is the code:
$email = "michael@wildbluepress.com, steve@wildbluepress.com, ashley@wildbluepress.com, carla@wildbluepress.com";

$email = "michael@wildbluepress.com";

$subject = "WBP - New Title Added";

// $message = "The title - ". $rsGetTitle["Title"] ." has been signed and has just been added to the database and Dropbox folders. Please proceed with the following:1. asd. 2. sdf.";

$message = "The title - TEST TITLE has been signed and has just been added to the database and Dropbox folders. Please proceed with the following:1. asd. 2. sdf.";

$arr = runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $message));
/

// if error happened print a message on the web page

if (!$arr["mailed"]) {

echo "Error happened:
";

echo $arr["message"];

}

/
// if error happened print a message on the web page

if (!$arr["mailed"]) {

echo "Error happened:
";

echo "File: " . $arr["errors"][0]["file"] . "
";

echo "Line: " . $arr["errors"][0]["line"] . "
";

echo "Description: " . $arr["errors"][0]["description"] . "
";

}
=========

and these are the results:
Error happened:

File:

Line:

Description:

=============
I also tried it without the bracket and the original error code and the result is the same as the original result.

lefty 7/9/2018



======================

I added that code and removed the brackets. The email didn't go out. This is the code:
$email = "michael@wildbluepress.com, steve@wildbluepress.com, ashley@wildbluepress.com, carla@wildbluepress.com";

$email = "michael@wildbluepress.com";

$subject = "WBP - New Title Added";

// $message = "The title - ". $rsGetTitle["Title"] ." has been signed and has just been added to the database and Dropbox folders. Please proceed with the following:1. asd. 2. sdf.";

$message = "The title - TEST TITLE has been signed and has just been added to the database and Dropbox folders. Please proceed with the following:1. asd. 2. sdf.";

$arr = runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $message));
/

// if error happened print a message on the web page

if (!$arr["mailed"]) {

echo "Error happened:
";

echo $arr["message"];

}

/
// if error happened print a message on the web page

if (!$arr["mailed"]) {

echo "Error happened:
";

echo "File: " . $arr["errors"][0]["file"] . "
";

echo "Line: " . $arr["errors"][0]["line"] . "
";

echo "Description: " . $arr["errors"][0]["description"] . "
";

}
=========

and these are the results:
Error happened:

File:

Line:

Description:

=============
I also tried it without the bracket and the original error code and the result is the same as the original result.


Do you have any other email events in this project, that work. Check your Email settings under security tab , to make sure they are setup correctly as it all looks fine to me . I use the same code for some of my tables and works fine . The only difference I have is a From field setup. runner mail function docs and email settings docs

R
RockyMtnHi author 7/11/2018

Do you have any other email events in this project, that work. Check your Email settings under security tab , to make sure they are setup correctly as it all looks fine to me . I use the same code for some of my tables and works fine . The only difference I have is a From field setup. runner mail function docs and email settings docs
========
That was it John! It didn't like that I hadn't specified a from email address, and after doing that, the emails went through.
I appreciate your sticking with it. Now I'm moving forward...