Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6

Thread: contact form

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    24
    Member #
    26993
    Hi there . I have got my code all setup the way i want but I wish to have the body messages come up bold..

    here is my code

    PHP Code:
    <?php
    $field_name 
    $_POST['cf_name'];
    $field_email $_POST['cf_email'];
    $field_message $_POST['cf_text1'];
    $field_message2 $_POST['cf_text2'];
    $field_message3 $_POST['cf_text3'];

    $mail_to = [EMAIL]'remail@email.casdasdasd'[/EMAIL];
    $subject 'Message from a site visitor '.$field_name;

    $body_message 'From: '.$field_name."\n";

    $body_message .= 'E-mail: '.$field_email."\n";

    $body_message .='If you have a written employment agreement,
    what is the name of the employer as written in that agreement:'
    .$field_message;

    $body_message .= 'If you dont have a written employment agreement,
    what is the name(s) that appear on your bank statement as paying your wages/salary: '
    .$field_message2;

    $body_message .= 'If you dont have a written employment agreement or are not sure who pays your wages/salary,
    who do you think is your employer: '
    .$field_message3;

    $headers 'From: '.$field_email."\r\n";
    $headers .= 'Reply-To: '.$field_email."\r\n";

    $mail_status mail($mail_to$subject$body_message$headers);

    if (
    $mail_status) { ?>
    <script language="javascript" type="text/javascript">
    alert('Thank you for the message. We will contact you shortly.');
    window.location = 'employee.html';
    </script>
    <?php
    }
    else { 
    ?>
    <script language="javascript" type="text/javascript">
    alert('Message failed. Please, send an email to [COLOR=#2075b7]remail@email.casdasdasd'[/COLOR]');
    window.location = 'employee.html';
    </script>
    <?php
    }
    ?>
     
    I am wanting to space out the email and also add bold to the follow lines;

    'If you have a written employment agreement,
    what is the name of the employer as written in that agreement:

    If you dont have a written employment agreement,
    what is the name(s) that appear on your bank statement as paying your wages/salary: '

    'If you dont have a written employment agreement or are not sure who pays your wages/salary,
    who do you think is your employer: '
    at the moment the email is coming out like so;

    From: asdasd
    E-mail: remail@email.casdasdasd'
    If you have a written employment agreement,
    what is the name of the employer as written in that agreement:asdasdasdIf you dont have a written employment agreement,
    what is the name(s) that appear on your bank statement as paying your wages/salary: asdasdasdIf you dont have a written employment agreement or are not sure who pays your wages/salary,
    who do you think is your employer: asdasdasd

    Thanks,

  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    The only way to style or rich-text your emails is to send HTML emails.
    Not everyone has the enabled with their web clients... but I'm sure you've
    seen some of those in your email. Any images must be absolute references,
    as the images don't go with the emails.

    You could send an email that is just a link with some kind of token key.
    They click the link and it actually goes to your website with something
    that you want to say to them, or something to do.


  4. #3
    Junior Member
    Join Date
    Feb 2011
    Posts
    24
    Member #
    26993
    bugger, thought it would be something easy

  5. #4
    Member
    Join Date
    Apr 2011
    Posts
    81
    Member #
    27344
    Liked
    3 times
    you can find a good example of how to construct an HTML email on

    http://php.net/manual/en/function.mail.php

    you will then use it as follows:

    <p><b>
    If you have a written employment agreement,
    what is the name of the employer as written in that agreement:
    </b></p>

    or something like


    <p>
    If you have a written <strong>employment agreement</strong>,
    what is the name of the employer as written in that agreement:
    </p>

    using the <strong>String</strong> tags were you need in bold.

    on another note i would just prepare a css code before and use it accordingly as follows:

    .bold_font {font-weight: bold;}

    and then in the email as follows:

    <p class="bold_font">
    If you have a written employment agreement,
    what is the name of the employer as written in that agreement:
    </p>

    css will help you reduce html code.
    i hope this is clear.


  6. #5
    Member
    Join Date
    Apr 2011
    Posts
    81
    Member #
    27344
    Liked
    3 times
    i would also use the following function:

    $body_message = wordwrap($body_message,70);

    to restrict the message the 70 characters long.

  7. #6
    Junior Member
    Join Date
    Feb 2011
    Posts
    24
    Member #
    26993
    Thanks for the tips guys.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:49 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com