PDA

View Full Version : Formatting E-mail With PhP?


Hartmann
Sun 18th Jun '00, 11:07pm
Is there a way to format e-mail with PhP? I have not read anything about it.... But I know that it is possible with CGI.

Hartmann
Fort Bend Internet Designs (http://www.fbid.net)

Hartmann
Wed 21st Jun '00, 10:47am
No one has the answer?

wandrer
Wed 21st Jun '00, 11:43am
yes, you can format email that is sent out through PHP. What specifically are you wanting to do ?

Hartmann
Wed 21st Jun '00, 8:53pm
Have you seen the script formmail.pl? It takes a form and makes it into a readable format. So if I had a form that had a text field called "Name" in the e-mail it would show up as Name: Persons Name.


Thank you,

firepages
Fri 23rd Jun '00, 2:35pm
$msg ="You have received a request for information from the ****** online messenger \n\n :Referrers message reads :\n \n $message\n\n";
$msg .="Received from:\t $Cname \n";
$msg .="Phone No:\t $Cphone \n";
$msg .="Fax No:\t $Cfax \n";
$msg .="E-mail:\t $Cmail \n";
$recipient ="info@************.com.au";
$subject = "$Csubject";
$mail_headers ="From: ********** MailerDaemon <>\n";
$mail_headers .="Reply to: $Cmail\n";

mail ($recipient,$subject ,$msg ,$mail_headers);
$Orecipient ="*****@*********.com.au";
mail ($Orecipient,$subject ,$msg ,$mail_headers);

Where $Cname ,Cfax etc is form input ie:<input type=text name=Cname>

\t is a newline \t is a tab! you can also get PHP to generate HTML output for e-mail its just a matter of adding the appropriate headers etc.


(The form above mails to 2 recipients)

Play around with it - its heaps easier and more customisable than PERL.

Hartmann
Sat 24th Jun '00, 1:24am
Thanks!!! Perl is soooooo slow! ;)

Bealers
Mon 26th Jun '00, 6:39am
you can do some pretty sexy thing with the array $HTTP_POST_VARS

check it out @ php.net

for example:

you post a form with name and address in it

at the receiving end you can just loop through $HTTP_POST_VARS and format then Vars nciely on the page (or in ths case the mail)

I'm sure someone has already done this, do a trawl on one of the script sites like weberdev.net

regs