Jump to content

Recommended Posts

Hello,

 

im using this code to send mail from my site, but all the emails i get are in gibberish...what i need to change in the code to fix this ? (i need hebrew)

 

this is the code:

 

<?php 
if ($_POST["email"]<>'') { 
$ToEmail = 'info@info.co.il'; 
$EmailSubject = 'הזמנת שולחן?'; 
$mailheader = "From: ".$_POST["contact@blabla.co.il"]."\r\n"; 
$mailheader .= "Reply-To: ".$_POST["contact@blabla.co.il"]."\r\n"; 
$mailheader .= "Content-type: text/html; charset=utf-8\r\n"; 
$MESSAGE_BODY = "Name: ".$_POST["name"]." "; 
$MESSAGE_BODY .= "Email: ".$_POST["email"]." "; 
$MESSAGE_BODY .= "Comment: ".nl2br($_POST["comment"])." "; 
mail($ToEmail, $EmailSubject, $MESSAGE_BODY, $mailheader) or die ("Failure"); 
?> 
Your message was sent
<?php 
} else { 
?> 
<form action="sendmail.php" method="post">
<table width="400" border="0" cellspacing="2" cellpadding="0">
<tr>
<td width="29%" class="bodytext">Your name:</td>
<td width="71%"><input name="name" type="text" id="name" size="32"></td>
</tr>
<tr>
<td class="bodytext">Email address:</td>
<td><input name="email" type="text" id="email" size="32"></td>
</tr>
<tr>
<td class="bodytext">Comment:</td>
<td><textarea name="comment" cols="45" rows="6" id="comment" class="bodytext"></textarea></td>
</tr>
<tr>
<td class="bodytext"> </td>
<td align="left" valign="top"><input type="submit" name="Submit" value="Send"></td>
</tr>
</table>
</form> 
<?php 
}; 
?>

Link to comment
https://forums.phpfreaks.com/topic/268055-php-mail-gibberish/
Share on other sites

You need to supply us with more information, I'm afraid. "Is gibberish" doesn't tell us a whole lot, other than the problem is probably related to encoding issues. However, not knowing exactly how the data looks before and after sending the e-mail, we cannot give you any specific help on this. Also, verify that your site is being sent as UTF-8, and that the browser does indeed return the user input as UTF-8 as well.

 

However, most importantly you really need to validate the input. As it stands now, this script is open for anyone to abuse in order to send lots and lots of spam-mails to anyone they want. Making it look like its you (or rather your site) that is spamming them.

Link to comment
https://forums.phpfreaks.com/topic/268055-php-mail-gibberish/#findComment-1375871
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.