mail function problem

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

pazzoboy
New php-forum User
New php-forum User
Posts: 10
Joined: Wed Dec 03, 2003 5:23 pm
Location: Rochester
Contact:

mail function problem

Postby pazzoboy » Wed Dec 03, 2003 5:36 pm

Hi,
I'm using a simple mail() function to handle form elements contained in another php document. The mail script is something like this:
<?php>

headers .= "From: $name <$email>\n";
$recipient = $contactname;
$msg .= wordwrap($msg, 1064);
$subject = "A message about your site from " . $name;
mail($recipient, $subject, $msg, $headers);
<?>
The script works perfectly on one host, so the variables are all okay. However, on another host that I am using, the email that I get back has the "from" address as either blank or "nobody". And the message body (which is $msg) is blank. The subject line is okay, except it doesn't show the value contained in $name.

Information is going between the two documents, because otherwise the email wouldn't come through, right?
Anything I can do to fix this, or why it won't work, would be greatly appreciated. Thanks!

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

mail

Postby ruturajv » Wed Dec 03, 2003 8:54 pm

headers .= "From: $name <$email>\n";
$msg .= wordwrap($msg, 1064);


Try assiging a value to a variable before string is appended to it

Code: Select all

$headers = "From: $name <$email>\n";
$msg = wordwrap($msg, 1064);


pazzoboy
New php-forum User
New php-forum User
Posts: 10
Joined: Wed Dec 03, 2003 5:23 pm
Location: Rochester
Contact:

mail function problem

Postby pazzoboy » Thu Dec 04, 2003 12:14 am

Yeah, I guess I should have mentioned that I tried that after reading another thread here about assigning a value before appending to a variable....
Anyway, I got a response from the host provider, and they couldn't help me. They did say that they're using php 4.3.1 (I'm looking at a 4.1 book). They gave me a link to their php settings and encouraged me to 'suggest' any required changes for my script to work. I have no idea what to look at to figure out what affects the mail function... can anyone here point me in the right direction after looking at this? Here it is:
http://ftphelp.secureserver.net/linux-phpinfo.html
Thanks again!


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 3 guests