[SOLVED] mail() problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Archy
Forum Contributor
Posts: 129
Joined: Fri Jun 18, 2004 2:25 pm
Location: USA

[SOLVED] mail() problem

Post 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
Archy
Forum Contributor
Posts: 129
Joined: Fri Jun 18, 2004 2:25 pm
Location: USA

Post by Archy »

Anybody got any ideas?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

bumping isn't cool when it's only an hour old.
leewad
Forum Commoner
Posts: 91
Joined: Tue May 11, 2004 8:32 am

Post 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 ?
Archy
Forum Contributor
Posts: 129
Joined: Fri Jun 18, 2004 2:25 pm
Location: USA

Post 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 : )
leewad
Forum Commoner
Posts: 91
Joined: Tue May 11, 2004 8:32 am

Post 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.
Archy
Forum Contributor
Posts: 129
Joined: Fri Jun 18, 2004 2:25 pm
Location: USA

Post 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 : )
Post Reply