Re: Sending HTML from PHP with 'mail' as a cron job
| From: | Michael Virnstein | Date: | Fri, 12 Apr 2002 11:02:18 +0000 |
| Subject: | Re: Sending HTML from PHP with 'mail' as a cron job | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-92741@lists.php.net to get a copy of this message | ||
i'd suggest using PEAR's mail class. It'll fit for all your needs and is
easy to use.
<phplists@woodenpickle.com> schrieb im Newsbeitrag
news:20020411145818.73717.qmail@pb1.pair.com...
> $headers = "Content-type: text/html\n";
> $fromEmail = urlencode( $dbQuery->adminEmail );
> $subject = "Your new eStore is ready!";
>
> $message = "<img
src=\"somedomain.com/images/estore.jpg\"><br><br>::name::,
> <br>Your new eStore is ready at <a
>
href=\"http://woodenpickle.com/shop\">http://woodenpickle.com/shop</a>.<br>Y
> ou can open the admin panel for it at the following link:<br><br><a
> href=\"http://woodenpickle.com/shop/admin.php\">
> http://woodenpickle.com/shop/admin.php</a>
> <br><br>You should receive
> another email with the temp login and pass later today.\n";
>
> $result = mysql_query( "SELECT * FROM customers" );
> while( $data = mysql_fetch_row( $result ) )
> {
> print ". ";
> $newMessage = str_replace( "::name::", $data->firstName,
$newMessage );
> $if( mail( $data->emailAddress, $subject, $newMessage,
"${headers}From:
> $fromEmail" ) )
> {
> $count++;
> }
> }
>
> echo( "Done." );
>
>
>
> "Stefen Lars" <stefenlars@hotmail.com> wrote in message
> news:LAW2-F76EFYamNfN1Xh00000c78@hotmail.com...
> > Hello all
> >
> > I have a script called 'report.php' that generates a report in HTML.
This
> > report must be created at regular intervals; hence I have set up a cron
> job
> > to call that script. The output of 'report.php' must be sent by e-mail.
I
> > use the following command:
> >
> > /usr/bin/lynx -source http://server.com/report.php | mail
> > -s "Report"
> > foo@bar.com
> >
> > This works fine. The result of report.php is sent to foo@bar.com.
> >
> > However, the results do not appear as HTML in the e-mail client, but as
> > text. This is due to the fact that the headers saying 'This is HTML' are
> > missing from the e-mail message sent.
> >
> > Does anyone know how it is possible to get 'mail' to add suitable
headers
> to
> > the above command, so that the receiving e-mail client knows that it is
> > getting an HTML and not a text message?
> >
> > Any help would be gratefully received. TIA.
> >
> > S.
> >
> >
> > _________________________________________________________________
> > Send and receive Hotmail on your mobile device:
> > http://mobile.msn.com
> >
>
>