SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict
    Join Date
    May 2007
    Location
    West Coast
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to Insert HTML in autoresponse for PHP formmail script

    here is the top part --

    // General Variables
    $check_referrer="no";
    $referring_domains=" http://domain.com/,http://www.domain.com/,http://subdomain.domain.com/";

    // Default Error and Success Page Variables
    $error_page_title="Error - Missed Fields";
    $error_page_text="Please use your browser's back button to return to the form and complete the required fields.";
    $thanks_page_title="Message Sent";
    $thanks_page_text="Thank you for your inquiry";

    // options to use if hidden field "config" has a value of 0
    // recipient info
    $charset[0]="iso-8859-1";
    $tomail[0]="info@site.com";
    $cc_tomail[0]="";
    $bcc_tomail[0]="";
    // Mail contents config
    $subject[0]="Contact";
    $reply_to_field[0]="Email";
    $reply_to_name[0]="Name";
    $required_fields[0]="Name,Email";
    $required_email_fields[0]="";
    $attachment_fields[0]="";
    $return_ip[0]="yes";
    $mail_intro[0]="The following are form results from site.com:";
    $mail_fields[0]="Subject,Name,Email,Phone,State,Comments";
    $mail_type[0]="text";
    $mail_priority[0]="1";
    // Send back to sender config
    $send_copy[0]="yes";
    $send_copy_format[0]="vert_table";
    $send_copy_fields[0]="Name,Email,Phone,Comments";
    $send_copy_attachment_fields[0]="";
    $copy_subject[0]="Contact";
    "// this text gets put above the main auto-responder email
    // you can format this via html tags, since we are sending as vert_table above, which uses html
    $copy_intro[0]="
    <html>
    <head>
    <style-type="text/css">
    </style>
    </head>
    <body>Thank you for contacting NEW SITE.<br>Your email (below) has been sent.<br><br>Someone will respond shortly.<br><br>If you require immediate assistance, please call xxx-PHONE-PHONE.<br><br>***************************************<br>This is an automated confirmation message.<br></body></html>";

    --------------------------------------

    but the error I get is "Parse error: syntax error, unexpected T_STRING in /home/site/public_html/submit/contact.php on line 49"

    forms has worked fine without html in autoresponse.

    2.) Also i wanted to have it work whereby if they only receive text emails it will change display automatically from html to text.

    Oh.and this is not for spam.....on that note.. I am actually looking for a strong anti-spam form-mail php script.

    thanks for any help or suggestions.
    Last edited by lukkas; Oct 6, 2007 at 18:01. Reason: clarity

  2. #2
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,104
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $copy_intro[0]="
    <html>
    <head>
    <style-type="
    text/css">
    </style>
    </head>
    <body>Thank you for contacting NEW SITE.<br>Your email (below) has been sent.<br><br>Someone will respond shortly.<br><br>If you require immediate assistance, please call xxx-PHONE-PHONE.<br><br>***************************************<br>This is an automated confirmation message.<br></body></html>"

    $copy_intro[0]="

    is , i'm guessing is line 49

    since you use " to delimite the string you need to use \" inside the string to comment out " inside the string up to where you use "; to end the string
    ex
    Code:
    <style-type=\"text/css\">
    do this for every element except ";

    Edit:


    or use $copy_intro[0]=' bla bla '; // note the single quote

    this way you will not need to escape "

  3. #3
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,104
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    2.) Also i wanted to have it work whereby if they only receive text emails it will change display automatically from html to text.

    ..... I am actually looking for a strong anti-spam form-mail php script.
    sorry, but see php mail function, you will need the mime type html mime type header. (you will (probably) need more headers to get past filters)

    do it right and you will get by most spam filters. but my guess is if hotmail receives 10 emails from the same source and it is marked as spam.

    I do have fully legit mail lists over 2000 members and there is no way (that I can figure out how) to get past hotmail spam filters.

    php.net is you friend when it comes to email (mail()).

  4. #4
    SitePoint Addict
    Join Date
    Aug 2007
    Location
    GR
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Typically to avoid looking like spam, you have to set the Return-Path header.
    Use phpmailer for sending e-mails.

  5. #5
    SitePoint Addict
    Join Date
    May 2007
    Location
    West Coast
    Posts
    345
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks so much this did work...I need to get more involved in basic php I guess.


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
  •