Page 1 of 1

Need help in php to send automatically an Email.

Posted: Wed Jun 01, 2005 1:14 pm
by Frenchdeveloper
Hi,

Could somebody help me?

The problem is:


I woild like my PHP program to be able to send an Email with in the content of the body, a table whose rows are extracted from a MySQL database. To do this I have included php instructions inside a variable named $body containing the htlm + php codes.

It does not work so I would appreciate to knwo if somenoe have solved yet thsi kind of problem.

Thanks and regards

Eric

Posted: Wed Jun 01, 2005 1:22 pm
by anjanesh
Please post your mail code so far.

Posted: Wed Jun 01, 2005 1:26 pm
by Burrito
a header to indicate to mail clients you're using html you will need.

add to your $body var you will need:
ex:

Code: Select all

$body = "Content-type: text/html;";
while($row=mysql_fetch_assoc($result)){
  $body .= "Column 1:".$row['colone']."<br>";
  $body .= "Column 2:".$row['coltwo']."<br>";
//etc
}

//now use the mail function to send it...**NOTE, you will need to add additional headers

mail($to,$subject,$body);
as mentioned, more headers you will need in your body tag.

recommend I do that you research mail()

THANK YOU VERY MUCH

Posted: Thu Jun 02, 2005 2:05 am
by Frenchdeveloper
Hi,

Thank you so much for your answer,I have not tried yet, I do it now but I am convinced that your answer is THE solution to the problem I was facing.

THANK YOU VERY MUCH.

Eric

:D