This has been a rough week, 4 assignments, an MIS, etc. I made that phpPostFix script, its very simple, but I won’t be able to use it. My main server with GoDaddy is so terrible. Its running an old version of PHP (4.2). This version did not have file_get_contents as a function, so to make up for it, a while ago, I set up the PEAR Compat replacements. To make a long story short, there are limitations in PHP 4.2 that for some reason, file_get_contents (the PEAR version used in PHP 4.2) can not accept URLs with more than 1 parameter.
I know what your thinking: “Just upgrade your version of PHP”. You obviously have never used a GoDaddy product. This is not an easy task, especially since their servers are married to Plesk and all the crap that come with it. Above all that the main server is fully deployed, I can’t risk upgrading a shady setup. Anyways, here is the script that I wrote. It does the job as explained in the previous post.
Using the script is as easy as the following:
Code:
$to = "[email protected]";
$subject = "Test email";
$query_string = 'to='.urlencode($to).'&subject='.urlencode($subject);
file_get_contents("http://www.someserver.com/phpPostFix.php?".htmlentities($query_string));
I still need to be able to send email from development server. So I spent some time thinking about it earlier this week. I’m going to write the emails which need to be sent to an XML file (send.xml). The schema will be as follows:
Code:
<email>
<to></to>
<cc></cc>
<bcc></bcc>
<subject></subject>
<body></body>
</email>
Every 5 minutes the main server will read the XML file, parse it, and send the emails based on the results. Once the emails are read, it will clear the original XML file (or append it to another backup.xml file). At this point any new emails will be written to a fresh send.xml. This method makes intuitive sense (sending in batch), especially since the development server could be sending hundreds of emails a day. Lets hope this goes without a problem.