|
Subject:
|
mail function
|
|
Posted By:
|
sunsetbay
|
Post Date:
|
6/22/2005 12:26:31 AM
|
please help me out.....
i am a newbie to php and i have to use php for my major project in school. i am currently using php 5.0.4, iis 5.1, mysql
i had incooperated a helpdesk.php for my contact page and the codes goes like this:
<?PHP if(($_GET['sender_name'] == "") || ($_GET['sender_email'] == "") || ($_GET['message'] == "")) { header("Location:contact.htm"); exit; }
$to="sunset_bay_85@yahoo.com"; $subject="PBL Help Desk";
$msg="E-MAIL SENT FROM PBL Site\n"; $msg.="Sender's Name:\t$_GET[sender_name]\n"; $msg.="Sender's E-Mail:\t$_GET[sender_email]\n"; $msg.="Message:\t$_GET[message]\n";
$mailheaders="From: My Site <sunset_bay_85@yahoo.com>\n"; $mailheaders.="Reply-To: $_GET[sender_email]\n"; $mailheaders.="Message: $_GET[message]\n"; mail($to,$subject,$msg,$mailheaders); // line 19 ?>
<html><head> <title>Temasek Polytechnic Online PBL Survival Kit</title> </head><body> <H1>The following email has been sent:</H1> <p><strong>Your Name:</strong><br> <? echo "$_GET[sender_name]"; ?>
<p><strong>Your Email Address:</strong><br> <? echo "$_GET[sender_email]"; ?>
<p><strong>Message:</strong><br> <? echo "$_GET[message]"; ?>
</body></html>
and my html code looks like these:
<html><head> <title>Help Desk</title> </head><body> <form action="helpdesk.php" method="GET" name="HelpDesk" id="HelpDesk">
<p><strong>Your Name:</strong> <input type="text" name="sender_name" size=30> </p> <p> </p> <p><strong>Your Email Address:</strong> <input type="text" name="sender_email" size=30> <br> </p> <p> </p> <p><strong>Message:</strong><br> <textarea name="message" cols=60 rows=10 wrap=virtual><Enter your text here></textarea></p>
<p align="center"><input type="submit" name="submit" value="Send this form">
</form></body></html>
there is no error with the syntes but i have got this error saying: "Warning: mail() [function mail]: SMTP server response: 5015.5.4 Invalid Address in c:/Inetpub/wwwroot/PBL/HelpDesk.php on line 19"
what could be the possible problem(s) that caused this error? i really need to complete this project.
anyone can help out???
desperate sunsetbay
|
|
Reply By:
|
anshul
|
Reply Date:
|
6/22/2005 3:02:08 AM
|
Previous to $mailheaders="From: My Site <sunset_bay_85@yahoo.com>\n";
Write ini_set(sendmail_from, 'sunset_bay_85@yahoo.com');
Also add HTML type for e-mail in you want $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= continue_your_code_here
Tell us, if it doesn't go. http://www.mediasworks.com/scripts/
|
|
Reply By:
|
sunsetbay
|
Reply Date:
|
6/22/2005 9:25:56 AM
|
thanx for helping me out but i have yet to test it out as the server is only available in school for the time begin. however, i have another thing i am still confused about. does that mean that by adding the codes, i do not have to edit the codes in the php.ini file which is listed below: ~?
[mail function] ; For Win32 only. SMTP = smtp.aol.com ; For Win32 only. sendmail_from = myemail@validadress.com
i am sorry that i am a little "noisy" but i still can't get the hang of php.
thanx a lot lot
desperate sunset
|
|
Reply By:
|
sunsetbay
|
Reply Date:
|
6/22/2005 9:53:03 PM
|
now i've got another problem. it shows this error after i've include the lines above:
Notice: Undefined variable: sendmail_from in c:\Inetpub\wwwroot\PBL\helpdesk.php on line 24
when this line says this:
ini_set($sendmail_from, 'me@localhost.com');
how do i solve this problem. by the way, i have also installed a mail server on the same station as the iis server. will there be any conflict between the 2??
|
|
Reply By:
|
anshul
|
Reply Date:
|
6/24/2005 3:33:04 AM
|
ini_set($sendmail_from, 'me@localhost.com'); Remove the extra $.
sendmail_from is a php.ini file variable and is available in all servers, reomte or local, Windows or Linux.
|
|
Reply By:
|
sunsetbay
|
Reply Date:
|
7/3/2005 8:59:03 PM
|
but i'm currently running on the online server. does it meant thatby adding the above code would sent the mail to the server's localhost instead of my expected email address. and on top of that, my hosting server does not have mail function. does that meant that my website can't perform any php email function?
anyone please help out.
desperate sunset
|