This topic is locked

Send Email Troubles

8/4/2012 12:55:15 AM
PHPRunner General questions
ladykathleen author

I am having trouble sending emails I even setup sending with gmail in the security menu and it does not work either. I have read the forum from top to bottom for hours on end looking for answers and still can't figure it out.
here is my code (with only the $from email address changed) which is in Before record added
if($record)

{

$from="test@test.com";

$msg="Job Applying For is ".$values['JobApplyingFor']."-".$record['Title']." Person is ".$values['FirstName']." ".$values['MiddleName']." ".$values['LastName']." There email is ".$values['Email'];

$subject="Job Match";

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

}

//** Send email with new data ****

$msg="";

foreach($values as $field=>$value)

{

if(!IsBinaryType(GetFieldType($field)))

$msg.= $field." : ".$value."\r\n";

}

$rsc = $values["Email"];

$from="test@test.com";

$subject2="Submitted Application Data to Reliable Staffing ";

runner_mail(array('to' => $rsc, 'subject' => $subject2, 'body' => $msg, 'from'=>$from));
The first part of the code had been in the system for a couple years and had been working the section Send email with new data is the newly added part.
I also noticed on the server logs this:
"POST /newjobs/JobsApp_add.php?ferror=1& HTTP/1.1" 200 154719
where is has the ferror is the part I am figuring is where it is erroring I am just not sure what is wrong.
Any help on this would be appreciated.

C
cgphp 8/4/2012

Try to debug the return value of the runner_mail function:

$arr = runner_mail(.........);
if (!$arr["mailed"])

{

echo "Error happened:
";

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

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

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

}
ladykathleen author 8/4/2012



Try to debug the return value of the runner_mail function:

$arr = runner_mail(.........);
if (!$arr["mailed"])

{

echo "Error happened:
";

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

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

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

}



Would you believe I get this
Error happened:

File:

Line:

Description:

C
cgphp 8/4/2012

Try this:

$arr = runner_mail(.........);

print_r($arr);
ladykathleen author 8/4/2012



Try this:

$arr = runner_mail(.........);

print_r($arr);



Ok at least it came up with something this time
Array ( [mailed] => [message] => SMTP Error: Could not authenticate. )

C
cgphp 8/4/2012

Make sure you are using your full email address as username: yourusername@gmail.com

ladykathleen author 8/4/2012



Make sure you are using your full email address as username: yourusername@gmail.com


Yes I am using the full and I even double checked the gmail by logging in with the same info

C
cgphp 8/4/2012

What is the port number?

ladykathleen author 8/4/2012



Yes I am using the full and I even double checked the gmail by logging in with the same info


Ok would you believe it was google. I tried logging in again using the same info and now I got a message saying someone was trying to log in from a different location and did I want to approve it. once I approved it the email is working.
so I guess this one is for future reference now for others that are having the same problem using a gmail account.
thanks Cristian for heading me on the right track