cannot get mail script to work

the mail() function

Moderators: macek, egami, gesf

bufhal
New php-forum User
New php-forum User
Posts: 37
Joined: Tue May 04, 2004 5:11 pm

cannot get mail script to work

Postby bufhal » Mon Aug 02, 2004 8:31 am

Hello;
I am a newbie trying to get a script that worked on another server a couple of weeks ago, to work on a new server.
I have the feeling the code is ok, but something else is wrong.
The hosting co has reg_globals on.
Please take a look and let me know if there is something wrong with the scripts (recommend.php and action.php) or if there is something else that could be the problem.
The thank you screen comes up after submitting, but the email never arrives.
Thanks
:sad:


recommend.php

Code: Select all

<form action="action.php" method="post">
Your name:<br> <input type="text" name="name" size="15"><br>
Your E-mail:<br> <input type="text" name="email" size="15"><br>
Your Friends E-mail:<br><input type="text" name="femail"><br>
Optional Message:<br>
<textarea rows="4" name="recon" cols="25">
</textarea><br>
<input type="submit" name="submit" value="Recommend!">
</form>

action.php

Code: Select all

<?
if (!$name) {echo "You must enter your name, Thank you"; } else {
if (!$email) {echo "Please enter your e-mail"; } else {
if (!$femail) {echo "Please enter your friend's email"; }
else{
$headers = "From: $email\r\nReply-To: $femail\r\n";
PRINT  "Thank you for recommending us!";
mail("$femail", "Great Site for Flu Shot Information in Western New York", "
For an excellent resource on Flu Clinic schedules in Western New York,
visit: <http://www.immunizewny.org> \r\n\r\n
$recon
",$headers);
}
}
}

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: cannot get mail script to work

Postby WiZARD » Wed Aug 04, 2004 1:20 am

i think what if you not getting any error message or mail need see php configuration file. maby mail server not understand your mail account.
ask about it at the hoster.

bufhal
New php-forum User
New php-forum User
Posts: 37
Joined: Tue May 04, 2004 5:11 pm

Postby bufhal » Wed Aug 04, 2004 8:09 am

Thanks for the reply.
Here is the comment form the hosting co.

I don't think you may know this but the script is trying to send e-mails
from the "Your E-mail:" filed like when I type in
something@somedomain.com it tryies to send the email from
something@somedomain.com and if you are not hosting this e-mail in the
account of the script, it will always do nothing.


I am new to this, can you please tell me what can I do to get this working?
Thank you very much..

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:

Postby ruturajv » Wed Aug 04, 2004 7:23 pm

I doubt.... what the hosting company says...

You can always fake the from header...

bufhal
New php-forum User
New php-forum User
Posts: 37
Joined: Tue May 04, 2004 5:11 pm

Postby bufhal » Wed Aug 04, 2004 7:45 pm

This is the great help they offered:
Your script might have worked on other servers. I didn't mean that it is not working, because it has errors or something like that. What I meant is that you cannot use the script the way it is set, i.e. sending from some e-mail address that is not hosted by us, to another e-mail address that is also not hosted by us.

We do not provide script development and debugging, so you have to configure your script by yourself. Or you can search for another script, if it's easier for you.


Do you know of a remedy for this script, Ruturajv?
I appreciate your feedback..


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest