This topic is locked

fromName not working

1/19/2017 9:06:53 PM
PHPRunner General questions
I
indigo author

Hi,
In the events tab, I want to send a mail using a "From Name"
So my mail code is:
$email=$values['Email'];

$from="abc@gmail.com";

$fromName="Some Name";
$msg="";

$msg.= "Dear ".$values['Name'].",

"."\r\n";
...

...

...
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'fromName'=> $fromName, 'from' => $from, 'htmlbody' => $msg, 'charset' => 'UTF-8'));

if(!$ret["mailed"])

echo $ret["message"];
Everything else is working, except $fromName.

Is there an issue with the code?

Please help.

lefty 1/20/2017



Hi,
In the events tab, I want to send a mail using a "From Name"
So my mail code is:
$email=$values['Email'];

$from="abc@gmail.com";

$fromName="Some Name";
$msg="";

$msg.= "Dear ".$values['Name'].",

"."\r\n";
...

...

...
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'FromName'=> $FromName, 'from' => $from, 'htmlbody' => $msg, 'charset' => 'UTF-8'));

if(!$ret["mailed"])

echo $ret["message"];
Everything else is working, except $fromName.

Is there an issue with the code?

Please help.


The only thing I see is brackets missing from error check and there is no subject field. What version of PHP are you using and build?

$subject="Subject name";
you may want to check with support on this one. see security settings for email settings and make sure use PHP mail custom mailer is not checked. I think fromName is automatic if using smtp and uses root_user by default if not FromName is not specified . In built in PHPrunner mail function() though it should work.
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'fromName' => $fromName, 'from' => $from, 'htmlbody' => $msg, 'charset' => 'UTF-8'));

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

echo $ret["message"];

}

The only other thing you may want to try is

'fromname' => 'Some Name'

in the array if the function params fromname exists in built in mail function which documentation shows it does but source code shows FromName ( not sure case sensitive makes a diff).

Note: I tried this in the past . I get mixed results some servers do not like mail that is coming from one name and coded as another . That is usually just with the email address though. They think it is spam. I remember AOL blocking my email when I used this. So What I did is use the Subject line to include the value a field in the database to put in the subject line who it was from . example
$subject="Subject Description" . '" .$values["Whoitisfrom"]."';