kattak Δημοσ. 12 Νοεμβρίου 2019 Δημοσ. 12 Νοεμβρίου 2019 Καλησπέρα, .Η σελίδα είναι html ,στη contact form που εχω ενώ λειτουργεί κανονικά, όταν λαμβάνω mail τα ελληνικά στο name k message εμφανιζονται έτσι αγοÏ�ιιιιιιιι!!!!ουουουου,, χρησιμοποιώ phpmailer κ όλα τα αρχεία είναι utf8, αλλα κατι κάνω λάθος...... το αρχείο <?php $field_name = $_POST['cf_name']; $field_email = $_POST['cf_email']; $field_message = $_POST['cf_message']; $mail_to = 'yourmail'; $subject = 'Message from a site visitor '.$field_name; $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$field_email."\n"; $body_message .= 'Message: '.$field_message; $headers = 'From: '.$field_email."\r\n"; $headers .= 'Reply-To: '.$field_email."\r\n" if ($mail_status) { ?> <script language="javascript" type="text/javascript"> alert('Thank you for the message. We will contact you shortly.'); window.location = 'contact_page.html'; </script> <?php } else { ?> <script language="javascript" type="text/javascript"> alert('Message failed. Please, send an email to [email protected]'); window.location = 'contact_page.html'; </script> <?php } ?>
Moderators Kercyn Δημοσ. 12 Νοεμβρίου 2019 Moderators Δημοσ. 12 Νοεμβρίου 2019 Το encoding του mail είναι σωστό;
kattak Δημοσ. 12 Νοεμβρίου 2019 Μέλος Δημοσ. 12 Νοεμβρίου 2019 (επεξεργασμένο) Γεια σου Kercyn, δεν γνωρίζω πολλά, όπως το if ((point1.add(point2).subtract(point3)).multiply(3.0).moveBy(vector1).equals(point0)) {.. μπορείς να μου πεις τι χρειάζεται να αλλάξω ή τι αρχεία να ανεβάσω;;; ευχαριστώ contact.php handler.php index.html Επεξ/σία 12 Νοεμβρίου 2019 από kattak
Moderators Kercyn Δημοσ. 13 Νοεμβρίου 2019 Moderators Δημοσ. 13 Νοεμβρίου 2019 Αντιγράφω από εδώ: Αναφορά σε κείμενο If you notice wrong displayed characters in the email it's because you need to properly set the Content-Type and the Charset in the headers of the email: <?php $headers = 'Content-Type: text/plain; charset=utf-8' . "\r\n"; ?> Mostly, UTF-8 is your best choice. You can set custom headers with the fourth parameter of the mail() function. To make the whole thing waterproof, add the following header too: <?php $headers .= 'Content-Transfer-Encoding: base64' . "\r\n"; ?> Now you can use the combination of UTF-8 and Base64 to properly encode the subject line and the recipient name like this: <?php $subject = '=?UTF-8?B?' . base64_encode('Test email with German Umlauts öäüß') . '?='; $recipient = '=?UTF-8?B?' . base64_encode('Margret Müller') . '?= <[email protected]>'; ?> And don't forget to Base64 encode the email message too: <?php $message = base64_encode('This email contains German Umlauts öäüß.'); ?> All references are taken from: https://dev.to/lutvit/how-to-make-the-php-mail-function-awesome-3cii Πάντως εγώ θα σου πρότεινα να μην ασχοληθείς εσύ αν σκοπεύεις αυτό που φτιάχνεις να βγει online. Θα μπορούσες να χρησιμοποιήσεις Joomla ή Wordpress ή Wix για να φτιάξεις τη σελίδα σου και να σκεφτείς δύο φορές αν θες και χρειάζεσαι πραγματικά μια contact me φόρμα. Αν πάλι είναι σα χόμπυ και για εκπαιδευτικούς σκοπούς, συνέχισε άφοβα!
kattak Δημοσ. 13 Νοεμβρίου 2019 Μέλος Δημοσ. 13 Νοεμβρίου 2019 Καλησπερα, έβαλα τα $headers αλλα πάλι δεν αναγνωρίζει τα ελληνικά. και έσβησα τα γερμανικά λογικά!!!! πάλι δεν τα αναγνωρίζει!!! ευχαριστώ παραθετω το αρχειο $field_name = $_POST['cf_name']; $field_email = $_POST['cf_email']; $field_message = $_POST['cf_message']; $mail_to = 'yourmail'; $subject = 'Message from a site visitor '.$field_name; $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$field_email."\n"; $body_message .= 'Message: '.$field_message; $headers = 'Content-Type: text/plain; charset=utf-8' . "\r\n"; $headers .= 'Content-Transfer-Encoding: base64' . "\r\n"; $headers = 'From: '.$field_email."\r\n"; $headers .= 'Reply-To: '.$field_email."\r\n" $subject = '=?UTF-8?B?' . base64_encode . '?='; $recipient = '=?UTF-8?B?' . base64_encode('Margret Müller') . '?= <[email protected]>'; if ($mail_status) { ?> <script language="javascript" type="text/javascript"> alert('Thank you for the message. We will contact you shortly.'); window.location = 'contact_page.html'; </script> <?php } else { ?> <script language="javascript" type="text/javascript"> alert('Message failed. Please, send an email to [email protected]'); window.location = 'contact_page.html'; </script> <?php } ?>
Προτεινόμενες αναρτήσεις
Δημιουργήστε ένα λογαριασμό ή συνδεθείτε για να σχολιάσετε
Πρέπει να είστε μέλος για να αφήσετε σχόλιο
Δημιουργία λογαριασμού
Εγγραφείτε με νέο λογαριασμό στην κοινότητα μας. Είναι πανεύκολο!
Δημιουργία νέου λογαριασμούΣύνδεση
Έχετε ήδη λογαριασμό; Συνδεθείτε εδώ.
Συνδεθείτε τώρα