Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: email error

  1. #1
    Regular Coder
    Join Date
    Feb 2007
    Posts
    217
    Thanks
    25
    Thanked 1 Time in 1 Post

    email error

    I'm using the coding below to send an activation email whenever someone signs up at my page.

    However I'm getting this error: Parse error: syntax error, unexpected T_VARIABLE in /home/a1332560/public_html/index.php on line 16

    which refers to the line with the url in it.
    What's wrong with that line? And how can I add some html coding with pictures to this email?

    echo "Your activation mail has been sent!";
    $to = $_POST[email];
    $subject = "mysite.com activation mail";
    $from = "From: sender@example.com\r\n"
    $body = "Thanks for registering at mysite.com.\n <br>Click <a href='http://mysite.com/activate.php'> here </a> to complete the registration.";
    if (mail($to, $subject, $body, $from)) {
    echo("<p>Message successfully sent!</p>");
    } else {
    echo("<p>Message delivery failed...</p>");
    }

  • #2
    Regular Coder poyzn's Avatar
    Join Date
    Nov 2010
    Posts
    266
    Thanks
    2
    Thanked 61 Times in 61 Posts
    you've missed ";" after "$from" string
    you can si,ply include any html-rich content but then should add content-header "Content-Type: text/html; charset=your encoding here"
    Last edited by poyzn; 12-08-2010 at 01:19 PM.


  •  

    Posting Permissions

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