Computing.Net > Forums > Programming > PHP Mail()-function- all on 1 line?

PHP Mail()-function- all on 1 line?

Reply to Message Icon

Original Message
Name: Johanovitch
Date: January 13, 2003 at 14:24:20 Pacific
Subject: PHP Mail()-function- all on 1 line?
OS: SuSE 7.2
CPU/Ram: 366MHz/64MB
Comment:

Hi, I'm having a little problem.
I have a form (in flash) which calls this code in a php-page:

$subject = "My subject";
$contactname = "my name";
$contactemail = "my@email.adres";
$message = "my message";

$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ".$realname." \r\n";
$headers .= "To: ".$contactname." \r\n";
$headers .= "X-Priority: 1\r\n";
$headers .= "X-MSMail-Priority: High\r\n";
$headers .= "X-Mailer: my.domain";
mail($contactemail, $subject, $message, $headers);


When I use the form, everything works, but everything is on 1 line, which makes it hard to read.
Is there faulty code?
What am I doing wrong?
any help apreciated!

I noticed that when I add an extra variable to the mail()-function, that I recieve the email, but from "Daemon user for apache" instead of the emailadres filled-in in the form. But the strange thing is that when I do that, that the text appears as I want it, including the linebreaks. But then there is an error in the emailheader, he then doesn't understand "MIME-Version 1.0"

any ideas?


Report Offensive Message For Removal


Response Number 1
Name: Me
Date: January 14, 2003 at 11:11:35 Pacific
Reply: (edit)

You may have uploaded it in Auto mode, you have to upload all your scripts in ASCII mode, you can prefer this setting in your upload manager. The wrong sender name is because of your server, contact your hosting company for any details.


Report Offensive Follow Up For Removal

Response Number 2
Name: Johanovitch
Date: January 15, 2003 at 08:36:54 Pacific
Reply: (edit)

I uploaded it in ascii mode. The wrong sender name appears only if I add an extra option to the mail()-funtion. If I use the script that you see in the first post, the sender name is correct. So I guess that is caused by the fact that it doesn't understand the extra option in the mail function.

But why does it work (almost) if I use mail()wrongly and doesn't work correct when I use it as posted above?

(by the way, it's my own server, so I can change anything if that would appear to be necessary)


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: PHP Mail()-function- all on 1 line?

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes Today.
Discuss in The Lounge