cURL / Mailing Lists / curl-users / Single Mail

curl-users

Using Curl to Prepare Email on Local Server

From: Greg Sims <greg_at_headingup.net>
Date: Wed, 5 Jul 2006 08:25:53 -0700

Hi All,

 

I am using curl command line in a script that sends email to a distribution
list. The script uses a simple form of curl to accomplish this:

 

     Echo 'header information for email'
>mailFileToSend

     Curl http://www.raystedman.org/power/0705.php >>mailFileToSend

     Sendmail .

 

This sequence works well to expand the dynamic php content of 0705.php into
straight html before sending the email. The script ran from crontab early
this morning and yielded a mailFileToSend that had headers and no content.
Perhaps there was a problem on the network or something. I saw this once
before in manual testing as well. The script works well most of the time
and sends the email off to the distribution list.

 

I need to make this script more robust. Two ideas come to mind:

            (1) check the resulting file for </html> as the last line and
retry curl if not

            (2) the 0705.php file is local to the server. Is it possible to
use curl without going off the server (without using the network) to
accomplish this?

 

Thanks in advance! Greg
Received on 2006-07-05