Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End php email send does not use color — Solution

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #35942
    mdemaree99
    Member

    I am working on a form that will send an email to myself and other users.
    It gathers inputs from the form and use HTML code in the form that will be sent to myself and others.

    I belive the issue is in the //$message =”$_POST[message]n n”;
    format, but not sure what the solution is. After trying a few soltions I have a couple of results.

    Original solution gives an exact text back to the user in the email.

    2nd solution gives the information back and will bold data, but will not show color. Ideally I would be able to enter an image in this form as well, but doubt this would work either.

    3rd try: works exactly as it should. However I have to hard code the data into the document and cannot pull information from the form. (see notes below for code)

    Any ideas?



    $to = $_POST;

    //$email = $_POST ;
    //change this to your email.
    $to = $_POST;
    $from = 'myemail.com' ;
    //change to jlarlington email address
    $subject = $_POST;

    //begin of HTML message
    // passes exact text that is in textbox--no html or bold
    $message = htmlentities($_POST);

    // Does not work--Sends email but it will bold, but no color
    //$message ="$_POST[message]n n";

    //Works I need to pull form
    $message = '
    Looool!!! I am reciving HTML email......
    Thanks Mohammed!
    * maaking.com


    *** Now you Can send HTML Email
    Regards
    MOhammed Ahmed - Palestine

    this is my email

    Bold

    Change color

    Image

     

     

    ';


    $headers = "From: $fromrn";
    $headers .= "Content-type: text/htmlrn";

    //options to send to cc
    $ccemail = $_POST ;
    if ($ccemail<>'')
    { $headers .= "Cc: $ccemailrn"; }

    //options to send bcc
    // $bccemail = $_POST ;
    // $headers .= "Bcc: $bccemailrn";

    if (!isset($_POST)) { // if page is not submitted to itself echo the form


    // FORM to input data for email
    //Predefines fields for the form
    $toemail = '[email protected]';
    $ccemail = '';
    // $bccemail = $bccquery;


    echo (" ");
    echo (" ");

    echo (" ");
    echo (" ");

    echo (" ");
    echo (" ");

    echo (" ");
    echo (" ");

    echo (" ");
    echo (" ");


    echo (" ");
    echo (" ");
    echo ("
    TO: $toemail
    CC: $ccemail
    BCC: $bccemail
    SUBJECT:
    BODY: ");


    echo ("
    ");


    //Send email once email is complete and Send Email clicked

    } else {
    //change this to your email.
    $to = "[email protected]";
    $from = "[email protected]";
    $subject = "Hello! This is HTML email";


    //end of message
    $headers = "From: $fromrn";
    $headers .= "Content-type: text/htmlrn";

    //options to send to cc+bcc
    //$headers .= "Cc: [email protected]";
    //$headers .= "Bcc: [email protected]";

    //send email
    if (mail($to, $subject, $message, $headers))
    {
    echo "Message has been sent....!";
    }
    else {
    echo 'There was a problem sending the email.';
    }

    }
    #93984
    mdemaree99
    Member

    Solution Found
    After testing the output of the post it seems there was a backslash added to each “.

    Solution:


    $message = $_POST ;
    $message = stripslashes($message);

    Next step is adding putting into fckeditor WYSIWYG textbox

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.