Skip to content

Instantly share code, notes, and snippets.

@tungd
Created March 26, 2013 02:04
Show Gist options
  • Save tungd/5242541 to your computer and use it in GitHub Desktop.
Save tungd/5242541 to your computer and use it in GitHub Desktop.
diff --git a/mail.php b/mail.php
index fbc1b00..2677337 100644
--- a/mail.php
+++ b/mail.php
@@ -7,9 +7,10 @@ while (!file_exists($wp_include) && $i++ < 10) {
}
require($wp_include);
- $name = iconv("UTF-8", "ISO-8859-2", $_POST['name']);
- $email = iconv("UTF-8", "ISO-8859-2", $_POST['email']);
- $comments = iconv("UTF-8", "ISO-8859-2", $_POST['comments']);
+ $name = sanitize_text_field($_POST['name']);
+ $email = sanitize_text_field($_POST['email']);
+ $comments = sanitize_text_field($_POST['comments']);
+
$thank_you = get_option('thank_you_text');
require_once('phpmailer.php'); //call php mailer
@@ -19,6 +20,7 @@ require($wp_include);
$mail->From = $email;
$mail->FromName = $name;
$mail->Subject = get_option('contact_subject');
+ $mail->CharSet = 'UTF-8';
$address = get_option('contact_email');
$mail->AddAddress($address, "Your Address");
@@ -45,5 +47,3 @@ require($wp_include);
</div>";
$mail->ClearAddresses();
-
-?>
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment