Page 1 of 1

[SOLVED] mail() problem

Posted: Thu Sep 23, 2004 11:40 am
by Archy
I have used the mail() function hundreds of times, and I have used the same code as I did the first time I ever used the code, but this problem has stumped me. The code I am using is:

Code: Select all

$content = "some text here";

$headers = "From: email here\r\n";
$to = "$email";
$re = "subject here";
$msg = "$content";
mail($to,$re,$msg,$headers);
$content simply contains the message that I want to display. It all works fine until I send the mail and I then recieve it. What I recieve is the email, but halfway through, all the spaces seem to dissapere, so I am left with one long word. I have copied the code into notepad (and turned off wordwrap) and there are no line breaks, or any weird characters that arent supposed to be there; I even copied it from notepad into the script, but I have not succeeded.

$content holds around 1,000 characters, and below is the writing which it messes up with, anyone got any ideas why this might be happening?

and will begin the construction of your site to the specification's you ordered.\n\nYou will be kept up to date at every stage of your site through an email, and also your through your account

Thanks

Posted: Thu Sep 23, 2004 12:46 pm
by Archy
Anybody got any ideas?

Posted: Thu Sep 23, 2004 1:41 pm
by feyd
bumping isn't cool when it's only an hour old.

Posted: Thu Sep 23, 2004 4:05 pm
by leewad
I had the same problem adding content into the database with strange charaters appearing - I found out that if I removed all the ' in the text it worked fine, so from the text you displayed here

specification's

I would try specifications ( leaving out the ' )

It worked for me - can I ask you which hosting company you are using ?

Posted: Thu Sep 23, 2004 5:08 pm
by Archy
Sorry, that sadly didnt work.

This is what im getting:
the construc tionofyoursitetothespecificationsyouordered.

From this code:

Code: Select all

$content = "... and will begin the construction of your site to the specification's you ordered.\n\nYou will be kept up to date at every stage of your site through an email, and also your through your account ...";
Im using VeusHosting Services a friend of mine owns it, although I dont know why you wanted to know : )

Posted: Thu Sep 23, 2004 5:24 pm
by leewad
Try the following this may work

Code: Select all

<?php
$email ="<--who it is to-->";
$from ="<--who it is sent from-->";
$subject ="Testing Mailing ";
$content =  "... and will begin the construction of your site to the specification's you ordered.

You will be kept up to date at every stage of your site through an email, and also your through your account ...
";
$content=stripslashes($content);
$email_header .= "From:$from\n";
mail($email, $subject, $content, $email_header);


?>
I just tried it and it worked fine.

Posted: Thu Sep 23, 2004 5:34 pm
by Archy
I have just rewrote the whole email and now it is working. I dont know what was wrong with it before, but I think that there must have been a character in there that was crearing some kind of error.

Thanks for your help though leewad : )