Click here to Skip to main content
15,909,539 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
GeneralRe: How to execute a URL in cron job at Linux Server Pin
cjoki23-Sep-10 5:58
cjoki23-Sep-10 5:58 
GeneralRe: How to execute a URL in cron job at Linux Server Pin
Varun Sareen23-Sep-10 7:25
Varun Sareen23-Sep-10 7:25 
GeneralRe: How to execute a URL in cron job at Linux Server Pin
cjoki23-Sep-10 11:58
cjoki23-Sep-10 11:58 
GeneralRe: How to execute a URL in cron job at Linux Server Pin
Varun Sareen23-Sep-10 18:47
Varun Sareen23-Sep-10 18:47 
GeneralRe: How to execute a URL in cron job at Linux Server Pin
markkuk24-Sep-10 0:07
markkuk24-Sep-10 0:07 
GeneralRe: How to execute a URL in cron job at Linux Server [modified] Pin
cjoki24-Sep-10 4:34
cjoki24-Sep-10 4:34 
GeneralHow to execute a URL in cron job at Linux Server Pin
Varun Sareen28-Sep-10 20:37
Varun Sareen28-Sep-10 20:37 
QuestionUTF-8 format with mail() Pin
grmihel220-Sep-10 4:30
grmihel220-Sep-10 4:30 
Hi php folks...

I decided to try to make an PHP script that a webform could call, to send an email, so I doesn't need the ugly mailto:xxx@yyy.domain in the form action.
So I have 2 pages. 1 frontend (html) and 1 backend (php).

The frontend contain an webform that on submit using the backend php as action, so its like:
index.html
sendemail.php
action="sendemail.php" (in the index.html form).

Everything works fine, and I recieving the emails as supposed... I have configured the php.ini to use my own smtp server (which I use at work too, so I know the SMTP server works).
the issue now is, that I want to send my emails as utf-8 format, cuz the need of some special characters inside the email?!?
I'm using the mail($to, $subject, $body, $header); as function right now... And when I type in some utf-8 formatted characters like ø, its viewed as ?? in the recieved email Frown | :(

How can I send my email()'s as utf-8?

I have try following:
- Set header of the email to utf-8:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-Type: text/plain; charset=utf-8' . "\r\n";
$headers .= 'From: ' . $_POST['email'] . "\r\n";



I'm using Eclipse PHP as php editor for development.

    $dato = date("d-m-y");
$to = "your@domain.dk";
$subject = "Web $dato";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-Type: text/plain; charset=utf-8' . "\r\n";
$headers .= 'From: ' . $_POST['email'] . "\r\n";

if($_POST['street'] != "")
    $street = $_POST['street'];
if($_POST['no'] != "")
    $no = $_POST['no'];
if($_POST['floor'] != "")
    $floor = $_POST['floor'];
if($_POST['name'] != "")
    $name = $_POST['name'];

//Set email body
$newline = "\r\n";
$body = "Date: $dato" . $newline .
$street . " " . $no . ", " . $floor . "." . $nnewline .
$navn;

//Send email
mail($to, $subject, $body, $headers);


Whitebox test:

Input:
$street = "ø";
$no = "53st";
$floor = "2nd";
$name = "æøå";
$dato = "20-09-2010";

Output SHOULD be:
Date: 20-09-2010
ø 53st, 2nd.
æøå


Actual output:
Date: 20-09-2010
?? 53st, 2nd.
??????

Questionhtml in database Pin
AndyInUK15-Sep-10 23:32
AndyInUK15-Sep-10 23:32 
AnswerRe: html in database Pin
Gerben Jongerius16-Sep-10 2:04
Gerben Jongerius16-Sep-10 2:04 
GeneralRe: html in database Pin
AndyInUK16-Sep-10 2:07
AndyInUK16-Sep-10 2:07 
GeneralRe: html in database Pin
cjoki16-Sep-10 7:53
cjoki16-Sep-10 7:53 
AnswerRe: html in database Pin
Luc Pattyn16-Sep-10 9:31
sitebuilderLuc Pattyn16-Sep-10 9:31 
Questionsessions Pin
AndyInUK14-Sep-10 7:08
AndyInUK14-Sep-10 7:08 
AnswerRe: sessions Pin
User 171649214-Sep-10 7:53
professionalUser 171649214-Sep-10 7:53 
AnswerRe: sessions Pin
cjoki15-Sep-10 10:05
cjoki15-Sep-10 10:05 
Question.NET to PHP Pin
AndyInUK12-Sep-10 23:58
AndyInUK12-Sep-10 23:58 
AnswerRe: .NET to PHP [modified] Pin
User 171649213-Sep-10 3:33
professionalUser 171649213-Sep-10 3:33 
AnswerRe: .NET to PHP Pin
cjoki13-Sep-10 5:00
cjoki13-Sep-10 5:00 
QuestionHosting web server on a device like camera embedded system Pin
mohit`128-Sep-10 10:25
mohit`128-Sep-10 10:25 
AnswerRe: Hosting web server on a device like camera embedded system Pin
Luc Pattyn8-Sep-10 11:14
sitebuilderLuc Pattyn8-Sep-10 11:14 
GeneralRe: Hosting web server on a device like camera embedded system Pin
mohit`129-Sep-10 3:50
mohit`129-Sep-10 3:50 
QuestionRe: Hosting web server on a device like camera embedded system Pin
Tony Richards8-Sep-10 13:10
Tony Richards8-Sep-10 13:10 
AnswerRe: Hosting web server on a device like camera embedded system Pin
mohit`129-Sep-10 3:51
mohit`129-Sep-10 3:51 
GeneralRe: Hosting web server on a device like camera embedded system Pin
cjoki9-Sep-10 4:48
cjoki9-Sep-10 4:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.