Re: HTML Mail script reading text from MySQL
| From: | Tom Chubb | Date: | Fri, 02 Jun 2006 15:33:16 +0000 |
| Subject: | Re: HTML Mail script reading text from MySQL | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237289@lists.php.net to get a copy of this message | ||
I've just read a similar post and think that I should use file_get_contents
and the preg_match for the <table> & </table> tags.
...But if anyone knows a better way I'm all ears!
On 02/06/06, Tom Chubb <tomchubb@gmail.com> wrote:
Sorry Mark, What I meant is say a page outputs an HTML table eg: <table width="100" cellspacing="0" cellpadding="0"> <tr>-- Tom Chubb tom@ps-promo.co.uk 07915 053312<td>a</td> <td>b</td> <td>c</td> <td>d</td> <td>e</td></tr> <tr><td>f</td> <td>g</td> <td>h</td> <td>i</td> <td>j</td></tr> <tr><td>k</td> <td>l</td> <td>m</td> <td>n</td> <td>o</td></tr> <tr><td>p</td> <td>q</td> <td>r</td> <td>s</td> <td>t</td></tr> <tr><td>u</td> <td>v</td> <td>w</td> <td>x</td> <td>y</td></tr> </table> But I want to get that code into the $message variable. I have written many mail scripts before it's just getting the data into the variable. Should I be using something like CURL? On 02/06/06, Mark Cain <mark@markcain.com> wrote: For my server configuration (Unix), mailing works like this for me. In the simplest manner mailing works in the following way: <? // build the email $mail_to = joe_blow@yahoo.com; $subject = "subject of mail goes here -- $variable_of_your_choosing"; $message = "The text of the message starts here $variable_of_your_choosing_2 $variable_of_your_choosing_3 "; $headers = "From: You@yourdomain.com\r\n" . "Reply-To: You@yourdomain.com\r\n"; //send email mail($mail_to, $subject, $message, $headers); ?> HTH, Mark Cain ----- Original Message ----- From: "Tom Chubb" <tomchubb@gmail.com> To: "[php] PHP General List" <php-general@lists.php.net> Sent: Friday, June 02, 2006 10:59 AM Subject: [PHP] HTML Mail script reading text from MySQLI can't work out how to load the text from a recordset result into a variable for sending using mail in a script. I have a script which creates a dynamic table then I want to load the table's HTML into a variable which will be echoed in the mailfunction.I can't work out how to do this. I've tried calling the file using exec and fopen but I don't get any result. I have googled and RTFM (especially variable scope) but just can'tworkout how to do it. Any help would be greatly appreciated. PS - I know there are many Mail classes out there, but I also realisethatthis is something I will want to know how to do at a later time. Thanks, Tom-- Tom Chubb tom@ps-promo.co.uk 07915 053312