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 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Jul 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Form Email Output styling Help

    I have created a html form which i inserted into my webpage and have done a php file to send me the details entered into the from via email however,

    i don't receive a email
    and

    i would like to receive the results with html formatting.
    I have looked everywhere to try find a solution but did not find one.

    Could someone please help please i am really really stuck.

    Thank You

    My HTML code

    Code:
    <form method="post" action="/form/php/sendresults.php">
    <label>First Name:  <input type="text" name="firstname" size="30" maxlength="30" />   
       </label>
    <label>Last Name:  <input type="text" name="lastname" size="30" maxlength="30" />   
       </label>
    <textarea name="comments" rows="8" cols="50"  style="margin-left:37px" />
    </textarea>
     <input type="submit" value="submit"  />
    </form>
    My linked php code

    PHP Code:
    <?php
    $to 
    'info@my.com';
    $subject $firstname;
    $message '
    <html>
    <head>
    <title>'
    .$firstname.'</title>
    </head>
    <body>
    <p>'
    .$firstname.'!</p>
    <table>
    <tr>
    <th>Full Name</th><th>Company Name</th><th>Company Registered Number</th><th>Phone Number</th>
    </tr>
    <tr>
    <td>'
    .$lastname.'</td><td>'.$comments.'</td><td>'.$firstname.'</td><td>'.$firstname.'</td>
    </tr>
    </table>
    </body>
    </html>
    '
    ;
    $headers  'MIME-Version: 1.0' "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";
    mail($to$subject$message$headers);
    ?>

  • #2
    Regular Coder
    Join Date
    Jun 2010
    Posts
    293
    Thanks
    63
    Thanked 8 Times in 8 Posts
    In my experience, sending emails is a tricky business! Different mail providers check for different things in the header - if something suspicious is seen, then the email goes directly to spam.

    But first - are you certain that you have sendmail correctly configured on your server? That is the first thing to check. Then, can you send a plain text email? If sendmail is correctly configured, you will need to do a Google search for "how to send mail to XXX", where XXX is the email provider (e.g. googlemail, yahoo, etc), then slowly ensure that what you do is robust. Sending HTML mail is often a *LOT* more complicated than sending a plain text email and not all clients will render HTML.

    I'm afraid I can't be any more help than that, because I am a very firm believer in "Keep It Simple & Straightforward" - I never send HTML mail, always plain text - it gets the message across and it's a whole lots less work to get it to send reliably to most recipients. I encourage you to ask yourself, "Why do I want to send HTML mail?" If the answer is "Because it looks pretty", well, I personally don't think recipients care about "pretty", I think they care about clear information, well layed out, in plain text. I may be old-school, but personally I prefer an email that looks like an email, not like a web page.

  • #3
    New to the CF scene
    Join Date
    Jul 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    HI XmisterIS, firstly thank you for your reply much appreciated, secondly yes the severs to send normal plain old emails without a problem. and the only reason why i want to use html is so i can receive the email in a organised format such as orders produced in a order form when received. But i have not been able to accomplish this at all i have not been able to get a inputted data and have it emailed and displayed within a html field.

    would you be able to help on this and if not then could you please show me how to format and organize a normal plain text mail which has it all clearly structured.

    thank you

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,509
    Thanks
    8
    Thanked 1,090 Times in 1,081 Posts
    Would the recipients rather receive a PDF file (attachment) of the "order form"? A plain-text email with a PDF attachment is easier (more well received) than an HTML email.

    I'm not sure of your coding skills, but FPDF is a nice way to create PDF documents using PHP.
    FPDF

    If that option is viable, you can create a test script to send a PDF attachment via email. Use any PDF file just for testing the email and attachment. If you can get that to work, then you are able to email 'any' PDF attachment, including a PDF file that you generate using FPDF.

  • #5
    New to the CF scene
    Join Date
    Jul 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    HI thank you taht is one option i can look into and my coding skills are average, if i am provided with a simple working code with a html output email or structured plain text then i can do the rest i just need a working code

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,509
    Thanks
    8
    Thanked 1,090 Times in 1,081 Posts
    Ooops, i double posted ... remove this one
    Last edited by mlseim; 07-18-2014 at 03:30 AM.

  • #7
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,509
    Thanks
    8
    Thanked 1,090 Times in 1,081 Posts
    Google this: php email html table

    This is one example from that search:
    http://css-tricks.com/sending-nice-html-email-with-php/

  • #8
    New to the CF scene
    Join Date
    Jul 2014
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi, i have looked into this i still cant seem to get it to work


  •  

    Posting Permissions

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