Friday, January 16, 2009

Sending Mail + Text with PHP

I am having trouble with this particular bit of code:

$toaddress = "5163596507@txt.att.net";
$subject = 'LIST';
$mailcontent = date('G i');

if($result){
//echo mysql_affected_rows().
echo 'Welcome to the Kissing Kontest. You will receive a text message presently.';

$was_sent = mail($toaddress, $subject, $mailcontent);

if ($was_sent) {
echo 'mail was sent.';
} else {
echo 'error';
}

} else {
echo mysql_error();
}

The mail is being routed through my server extremely slowly, so it's difficult to tell if the script works when I'm working on it. It seems also, that it helps to have the variables declared outside of the conditional "if($result)".

Still unclear on the difference between double and single quotes.

ok - figured it out
to address string must be in single quotes

wrong ---->> $toaddress = "5163596507@txt.att.net";
correct ------->$toaddress = '5163596507@txt.att.net';

Tomorrow I'll start by changing the return address, I think.

No comments: