Hi all,
I've got a small problem that hopefully someone can help with. Here's the background, I've been forced to move back to dial-up access (sob,sob,sob) and have placed my webpage on a buddy's sever. I'm writing a mail utility that will allow me to write my email on my own server (running on localhost), save them to a database, and them send them all at once when I'm connected. All the processing that is done on localhost works without a hitch. My problem is passing the variables to the script on my buddy's server. My idea is to use the urlencode() function to prepare the variables for transfer, contructor the url that would result from a GET if I were using a form, then pass the url into the header() function. Here's the code:
<?php
/ This file is on my server. All the variables being passed in the sendMail() function are valid and present. /
function sendMail($id, $addr_to, $addr_from, $subject, $body, $signature) {
$to = urlencode($addr_to);
$from = urlencode($addr_from);
$subject = urlencode($subject);
if ($signature == 'personal') {
$signature = "\n\n\nGeoff\n(403)931-3989\nwww.mithril.com\n";
}
else if ($signature == 'professional') {
$signature = "\n\n\nGeoff A. Virgo, B.Sc., ITA\n(403)931-3989\nwww.mithril.com\n";
}
$body =urlencode($body . $signature);
$url = "http://205.251.213.131/~mithril/mail/send_mail.php?to=".$to."&from=".$from."&subject=".$subject."&body=".$body;
header("Location: $url");// or die("Unable to send email");
}
?>
This is the receiving script which resides on my buddy's machine (it is in the folder specifed by the url🙂:
<?php
$to = urldecode($to);
$from = urldecode($from);
$subject = urldecode($subject);
$body = urldecode($body);
mail("$to", "$subject", "$body", "From: \"Geoff A. Virgo\" <$replyto>\nReply-To: \"Geoff A. Virgo\" <$replyto>\nX-Sender: Reply-To: \"Geoff A. Virgo\" <$replyto>\nX-Mailer: www.mithril.com via $SERVER_SOFTWARE");
?>
Thanx any enlightenment you may be able to provide!!!
Cheers,
Geoff