SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Mail function?

  1. #1
    SitePoint Enthusiast
    Join Date
    May 2002
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mail function?

    Hi,

    I'm using the built in mail function as follows:

    $to=me@mydomain.com;
    $subject="Website Contact";
    $body="<html><body>First Name: $fname<BR>Last Name: $lname</body></html>";
    $headers = "MIME-Version: 1.0rn";
    $headers .= "Content-type: text/html; charset=iso-8859-1rn";
    $headers="From: $email";
    mail("$to","$subject","$body","$headers");

    The fname, lname and email values are being passed from a form.

    The email displays fine as above, but as soon as I add a third variable to the email body:
    $body="<html><body>First Name: $fname<BR>Last Name: $lname<BR>Another Variable: $variable</body></html>";

    the email displays with all the html code??

  2. #2
    Old Fogey mancroft's Avatar
    Join Date
    Oct 2002
    Location
    lost
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dunno. try... $body="<html><body><div>First Name: $fname<BR>Last Name: $lname<BR>Another Variable: $variable</div></body></html>";
    :

    :

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2002
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    No, the div tag didn't do anything...

    This is crazy!!! As soon as I add another CHARACTER the email is displayed with all the tags visible.

    What am I missing???

  4. #4
    Old Fogey mancroft's Avatar
    Join Date
    Oct 2002
    Location
    lost
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    still dunno... try...$body="<html><body><div>","First Name: $fname","<BR>","Last Name: $lname","<BR>","Another Variable: $variable","</div></body></html>";
    :

    :

  5. #5
    ********* Genius Mike's Avatar
    Join Date
    Apr 2001
    Location
    Canada
    Posts
    5,458
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Try using better code first...

    PHP Code:
    $to 'me@mydomain.com';
    $subject 'Website Contact';
    $body "<html><body>First Name: $fname<br>Last Name: $lname</body></html>";
    $headers "MIME-Version: 1.0rn\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1rn\n";
    $headers .= "From: $email\n";
    mail($to,$subject,$body,$headers); 
    Mike
    It's not who I am underneath, but what I do that defines me.

  6. #6
    SitePoint Enthusiast
    Join Date
    May 2002
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank-you...


Bookmarks

Posting Permissions

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