SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Having problems with the message in php mail

    I am trying to mail using mail. Mail is configured correctly and does work. I am having problems with the message in php mail:

    Code:
    $message = "<p>Welcome to the site!</p><p>These additions were made:</p><p>addition1=$addition1</p><p>addition2=$addition2</p>";
    mail('$email', 'Changes', '$message');
    Lets see what you can do with this.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,321
    Mentioned
    462 Post(s)
    Tagged
    8 Thread(s)
    What problems are you having?

  3. #3
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have tried with double quotes, single quotes and no quotes. I triple checked the surronding code for errors but I am getting this error on the $message line.

    Parse error: syntax error, unexpected T_STRING in /path/file.php on line 29
    Is there something wrong with my syntax with <p></p>?

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,321
    Mentioned
    462 Post(s)
    Tagged
    8 Thread(s)
    I don't know enough about this to be a real help, but if you want to output HTML in the message body, you have to specify that. So try adding a fourth $headers part to the mail() function and include something like this:

    PHP Code:
    $header "Content-Type: text/html; charset=UTF-8;\r\n";
    mail($email'Changes'$message$header); 
    Also, try removing those quotes around the variables in the mail() function.

  5. #5
    SitePoint Zealot
    Join Date
    Sep 2010
    Posts
    131
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Added header and took out the quotes. Here is the real massage:

    $message = "<p>Welcome to Philosophaie's Astronomy Site!</p><p>Thank you, $username for Registering.</p><p>To complete your membership click the link below.</p><p><a href = "http://www.philosophaie.heliohost.org/afterregister.php/id=$id">Complete Registration - Click Here</a></p>";

    Where am I going wrong?


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
  •