Results 1 to 5 of 5

Thread: PHP to email

  1. #1

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372

    PHP to email

    Hi guys,

    I have a set of php scripts which are used for a show/movie database. There is a reservation form which then sends an email to the Box Office. The problem is, the box office uses StarOffice for their email and for some reason, which I don't know, the email is coming through as gobbledygook. Here is the bit of code that sends the email:

    Code:
    function send_email() // sends email
    {
    global $name_title_, $name_, $address_, $city_, $country_, $zip_, $home_phone_, $work_phone_, $email_, $contact_method_, $contact_method2_, $contact_method3_, $movies_, $number_of_tickets_, $seating_type_, $main_message_, $tickets_, $credit_card_payment_, $price_;
    global $qft1_days;
    
    
    $headers  = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    
    $now = date("m/d/Y, D h:i a"); // gets the date/time now
    
    $message=" <html> <head> </head> 
    <body> 
    <b><font color=\"#000099\">A NEW RESERVATION</b> <BR>
    <b><font color=\"#000099\">$now</b></font><BR>
    <BR align=\"left\"><i><b><font color=\"#000099\">Customer's info:</b></i>
    <BR align=\"left\"> <font color=\"#000099\"><b>Name:</b></font> $name_title_ $name_
    <BR align=\"left\"> <font color=\"#000099\"><b>Address:</b></font> $address_
    <BR align=\"left\"> <font color=\"#000099\"><b>City:</b></font> $city_
    <BR align=\"left\"> <font color=\"#000099\"><b>County:</b></font> $country_
    <BR align=\"left\"> <font color=\"#000099\"><b>Postcode:</b></font> $zip_
    <BR align=\"left\"> <font color=\"#000099\"><b>Home Phone:</b></font> $home_phone_
    <BR align=\"left\"> <font color=\"#000099\"><b>Work Phone:</b></font> $work_phone_
    <BR align=\"left\"> <font color=\"#000099\"><b>E-mail:</b></font> $email_
    <BR align=\"left\"> <font color=\"#000099\"><b>Contact method:</b></font> $contact_method_ $contact_method2_ $contact_method3_
    <BR align=\"left\"> <font color=\"#000099\"><b>Message:</b></font> $main_message_
    
    <BR><BR align=\"left\"><b><i><font color=\"#000099\">Reservation info:</font></i></b>
    
    <BR align=\"left\"> <font color=\"#000099\"><b>Show:</b></font> $movies_
    <BR align=\"left\"> <font color=\"#000099\"><b>Number of tickets </b></font> $number_of_tickets_ 
    <BR align=\"left\"> <font color=\"#000099\"><b>Seats types:</b></font> $seating_type_
    <BR align=\"left\"> <font color=\"#000099\"><b>Reservation date:</b></font> $qft1_days
    
    
    
    </p>
    </body> 
    </html>";
    //[email protected]
    //[email protected]
    mail("[email protected]", "Show Reservation", "$message", $headers); // sends an email 
    }
    Could someone please tell me how to change it so that the information goes as straight text rather than html, so that it can be properly read using StarOffice?
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  2. #2

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    It's OK, I think I got it.
    I can't test it properly til tomorrow so I may be back.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  3. #3
    Fanatic Member MoMad's Avatar
    Join Date
    Oct 2000
    Location
    Seattle, WA
    Posts
    625
    What the hell? You have a html message (ala tables and html tags) and you are not sure why your message is HTML?? Wow... man come on, just change your message = field to be text only... or...

    Use a MIME class... I had one somewhere, ill upload it (just change .txt to .php) and use that class:

    actually ill point you to the site i downloaded it at:

    http://www.phpbuilder.com/columns/kartic20000807.php3

    Read the article, understand it, download the class, test it out, do whatever with it, implement it
    :MoMad:
    Nice Sig!

    http://go.to/momad/ Status: Not Ready

  4. #4

    Thread Starter
    Hyperactive Member GingerNut's Avatar
    Join Date
    May 2002
    Location
    Are those my feet?
    Posts
    372
    Hi MoMad,

    The problem was, the script was so bloody long that i couldn't see where the prob was. It was only when I isolated the mail part to post here that I noticed what to do.
    How is it one careless match can start a forest fire, but it takes a whole box to start a campfire?

    Global Freelancers | Web Traffic Analyser

  5. #5
    Fanatic Member MoMad's Avatar
    Join Date
    Oct 2000
    Location
    Seattle, WA
    Posts
    625
    lol.. you should use classes man, goto:

    http://www.phpclasses.org

    to see some cool classes, i recommend (DB.class.php -- pretty cool and i helped make it better )

    Also, using classes simplifies everything and minimizes your "mistakes" or "debugging"...
    :MoMad:
    Nice Sig!

    http://go.to/momad/ Status: Not Ready

Posting Permissions

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



Click Here to Expand Forum to Full Width