Roundcube Community Forum

Release Support => Pending Issues => Topic started by: InQontroll on December 03, 2014, 05:21:47 PM

Title: Webclient html reading problem.
Post by: InQontroll on December 03, 2014, 05:21:47 PM
Hello,

I made a contact script with html formatting system built in to it.
So when someone sends a mail i get the formatting in my mailbox.

Now thats a problem since i only see the html as text.

QuoteForm details below.

First Name: ***
Last Name: ***
Email: ***@hotmail.com
Telephone: +*****
Comments: <p><em>hey </em>this<s> is</s> me<a ="http://hey.be"> talking</a> to a<strong> mailbox</strong> :(</p>

Now in settings html is enabled and is set on utf-8.

Someone got an idea on how to get this working for me?
I would apreciate this a lot since i am building this website for my boss.

Thanks in advance people!


-* InQontroll
Title: Re: Webclient html reading problem.
Post by: SKaero on December 03, 2014, 05:34:32 PM
Its most likely a problem with the script your using to send the mail not with Roundcube. Are you using PHP to send the email?
Title: Re: Webclient html reading problem.
Post by: InQontroll on December 03, 2014, 05:40:14 PM
yes, i am.
Still if you where able to help me great!

:)

<form name="contactform" method="post" action="contact.php">

  <label for="first_name">First Name *</label></br>



  <input  type="text" name="first_name" maxlength="50px" size="30px"></br></br>



  <label for="last_name">Last Name *</label></br>



  <input  type="text" name="last_name" maxlength="50px" size="30px"></br></br>



  <label for="email">Email Address *</label></br>



  <input  type="text" name="email" maxlength="80px" size="30px"></br></br>



  <label for="telephone">Telephone Number</label></br>


  <input  type="text" name="telephone" maxlength="30px" size="30px"></br></br></br></br></br>



  <label for="comments">Comments *</label></br>



  <textarea  id="comments" name="comments" maxlength="1000px" style="height: 200px;"style="border:2px solid #000;" ></textarea></br>


  <input type="submit" value="Submit">   

</form>

<script>
CKEDITOR.replace( 'comments' )
</script>

<?php

if(isset($_POST['email'])) {

   

   
// EDIT THE 2 LINES BELOW AS REQUIRED

   
$email_to = "[email protected]";

   
$email_subject = "E-mail van philippehoornaert.be";

   

   

   function
died($error) {

       
// your error code can go here

       
echo "Onze excuzes voor dit ongemak er zit een fout in uw gegevens gelieve opnieuw in te vullen. ";

       echo
"Deze fouten zie je hier onder:<br /><br />";

       echo
$error."<br /><br />";

       echo
"Ga terug en vul dit opnieuw in, groeten.<br /><br />";

       die();

   }

   

   
// validation expected data exists

   
if(!isset($_POST['first_name']) ||

       !isset(
$_POST['last_name']) ||

       !isset(
$_POST['email']) ||

       !isset(
$_POST['telephone']) ||

       !isset(
$_POST['comments'])) {

       
died('We are sorry, but there appears to be a problem with the form you submitted.');      

   }

   

   
$first_name = $_POST['first_name']; // required

   
$last_name = $_POST['last_name']; // required

   
$email_from = $_POST['email']; // required

   
$telephone = $_POST['telephone']; // not required

   
$comments = $_POST['comments']; // required

   

   
$error_message = "";

   
$email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';

 if(!
preg_match($email_exp,$email_from)) {

   
$error_message .= 'Het e-mail adress die u hebt ingegeven blijkt ongeldig te zijn.<br />';

 }

   
$string_exp = "/^[A-Za-z .'-]+$/";

 if(!
preg_match($string_exp,$first_name)) {

   
$error_message .= 'De voornaam die u hebt ingegeven blijkt ongeldig te zijn.<br />';

 }

 if(!
preg_match($string_exp,$last_name)) {

   
$error_message .= 'Uw achternaam blijkt niet te kloppen.<br />';

 }

 if(
strlen($comments) < 2) {

   
$error_message .= 'Het berricht die u schreef was niet in orde probeer opnieuw.<br />';

 }

 if(
strlen($error_message) > 0) {

   
died($error_message);

 }

   
$email_message = "Form details below.\n\n";

   

   function
clean_string($string) {

     
$bad = array("content-type","bcc:","to:","cc:","href");

     return
str_replace($bad,"",$string);

   }

   

   
$email_message .= "First Name: ".clean_string($first_name)."\n";

   
$email_message .= "Last Name: ".clean_string($last_name)."\n";

   
$email_message .= "Email: ".clean_string($email_from)."\n";

   
$email_message .= "Telephone: ".clean_string($telephone)."\n";

   
$email_message .= "Comments: ".clean_string($comments)."\n";

   

   

// create email headers

$headers = 'From: '.$email_from."\r\n".

'Reply-To: '.$email_from."\r\n" .

'X-Mailer: PHP/' . phpversion();

@
mail($email_to, $email_subject, $email_message, $headers);  

?>



<!-- include your own success html here -->



Bedankt om ons te contacteren!
Philippe neemt zo snel mogelijk contact met u op.
u kunt ons ook altijd telefonish contacteren!



<?php

}

?>


Thats the code for the html/php contact page and the html editor is from ckeditor combined the two hoping it would work!.
the website contact page:
http://philippehoornaert.be/contact.php

hope that helps enough :s

Thanks in avance!
Title: Re: Webclient html reading problem.
Post by: SKaero on December 03, 2014, 05:43:56 PM
In that case I would highly recommend using a libary like PHPMailer to handle the sending of email: https://github.com/PHPMailer/PHPMailer I would also highly recommend that you sanitize the html to make sure your not sending anything dangerous.
Title: Re: Webclient html reading problem.
Post by: InQontroll on December 03, 2014, 05:47:08 PM
ok thanks sanetizing is for later on need to get it wotking first :)

thanks for the hints!

** no thank you button :( to bad i would ave thanked you fot his!