www.webdeveloper.com
Results 1 to 4 of 4

Thread: formatting an e-mail

  1. #1
    Join Date
    Dec 2003
    Posts
    41

    formatting an e-mail

    I'm trying to send my form information in an e-mail, but i want to format parts of it... for example, if this is my message:

    $to = "me@myplace.com";
    $subject = "New Service Customer Application";
    $msg = "Service Application\n";
    $header = "From: New Customer";

    $msg.= "\nMEMBERSHIP INFORMATION\n";
    $msg.= "Name: ".$_SESSION['first']." ".$_SESSION['last']."\n";
    $msg.= "Mailing Address: ".$_SESSION['mailAddress']."\n";
    $msg.= "City: ".$_SESSION['mailCity']." ";
    $msg.= "State: ".$_SESSION['mailState']." ";
    $msg.= "Zip Code: ".$_SESSION['mailZip']."\n";
    $msg.= "Previous Address: ".$_SESSION['preAddress']."\n";
    $msg.= "City: ".$_SESSION['preCity']." ";
    $msg.= "State: ".$_SESSION['preState']." ";
    $msg.= "Zip Code: ".$_SESSION['preZip']."\n";

    $msg.= "\nCREDIT INFORMATION\n";
    $msg.= "Previous Telephone Number: ".$_SESSION['preAC']."-".$_SESSION['prePrefix']."-".$_SESSION['preNum']." ";
    $msg.= "Disconnect Date: ".$_SESSION['dcMonth']."/".$_SESSION['dcDay']."/".$_SESSION['dcYear']."\n";
    $msg.= "Name service was under: ".$_SESSION['nameUnder']." ";


    $msg.= "\nAUTOMATIC BILL PAYMENT\n";
    if ($_SESSION['bankDeductY'] != "")
    $msg.= "Enroll in Automatic bank Deduct: ".$_SESSION['bankDeductY']."\n";
    if ($_SESSION['bankDeductN'] != "")
    $msg.= "Enroll in Automatic bank Deduct: ".$_SESSION['bankDeductN']."\n";

    $msg.= "\nTERMS AND CONDITIONS AGREEMENT: ".$_SESSION['verify']."\n";

    mail($to, $subject, $msg, $header);?>


    if I want the items in red here to be bold, how would I do this??

  2. #2
    Join Date
    Jun 2004
    Location
    Between keyboard and chair
    Posts
    77
    Assuming the recipient's email client supports html, just put tags in it.
    Code:
    $msg.="\n<b>Membership Information</b>\n";
    Notepad: Reliability, Compatibility, and Simplicity. Quite possibly the perfect development environment.

  3. #3
    Join Date
    Dec 2003
    Posts
    41
    Yeah, I tried that, seems so simple, doesn't it? But it doesn't work

  4. #4
    Join Date
    Jun 2004
    Location
    Between keyboard and chair
    Posts
    77
    Hmmm...maybe your client doesn't support html, or maybe you need to go through the whole process of
    Code:
    <html><head></head>
    <body>...
    I guess try the manual and see if you can figure it out from there.

    PHP manual for mail()

    *EDIT* I just noticed this while setting up an email script on my own (from php.net):

    PHP Code:
    /* To send HTML mail, you can set the Content-type header. */
    $headers  "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

    to send the mail
    /* and now mail it */
    mail($to$subject$message$headers); 
    Last edited by iamlucky13; 08-17-2004 at 11:57 AM.
    Notepad: Reliability, Compatibility, and Simplicity. Quite possibly the perfect development environment.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles