|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
PHP Mail
I'm running apache on win32 with php installed. How can I send mail? What SMTP do I use? I get this warning when executing a mail script:
Warning: Failed to Receive in C:\indigoperl\apache\htdocs\FormToEmail.php on line 81 |
|
#2
|
|||
|
|||
|
CyCo,
Can you paste the script you're using? As for setting up outgoing mail in PHP, open your PHP.INI file, and find this line: [mail function] ; For Win32 only. SMTP = xx.xxx.xxx.xxx And replace the x's with your ISP's outgoing SMTP server settings... That's all there is to it.
__________________
____________________________________________ Developer Shed Weekly Writer | DevArticles Forum Moderator Build Your Own KlipFolio Klip With PHP FrankManno.com - Under Construction Design Interactive Group - Under Construction |
|
#3
|
|||
|
|||
|
BTW, even before the prior post, I had changed the SMTP = to my isp smtp conf. and tried several different free smtp server's addresses and still it would not mail...
<?php /* Thank you for choosing FormToEmail by ScriptsThatWork.com Version 1.0 Created February 21st 2003 COPYRIGHT ScriptsThatWork.com 2003 You are not permitted to sell this script, but you can use it, copy it or distribute it providing that you do not delete this copyright notice, and you do not remove any reference to FormToEmail or ScriptsThatWork.com DESCRIPTION FormToEmail allows you to place a form on your website which your visitors can fill out and send to you. The contents of the form are sent to the email address which you specify below. The form allows your visitors to enter their name, email address and comments. Your visitors (and nasty spambots!) cannot see your email address! When the form is sent, your visitor will get a confirmation of this on the screen, and will be given a link to continue to your homepage, or other page if you specify it. This is a PHP script. In order for it to run, you must have PHP on your webhosting account. If you are not sure about this, then ask your webhost about it. SETUP INSTRUCTIONS Step 1: Put the form on your webpage Step 2: Enter your email address and continue link Step 3: Upload the files to your webspace Step 1: To put the form on your webpage, copy the code below as it is, and paste it into your webpage: <form action="FormToEmail.php" method="post"> <table border="0" bgcolor="#F0ECEC" cellspacing="5"> <tr><td><font face="arial"><b>Name</b></font></td><td><input type="text" size="30" name="name"></td></tr> <tr><td><font face="arial"><b>Email address</b></font></td><td><input type="text" size="30" name="formemail"></td></tr> <tr><td valign="top"><font face="arial"><b>Comments</b></font></td><td><textarea name="comments" rows="6" cols="30"></textarea></td></tr> <tr><td> </td><td><input type="submit" value="Send"><font face="arial" size="1"> FormToEmail by <a href="http://scriptsthatwork.com">ScriptsThatWork.com</a></font></td></tr> </table> </form> Step 2: Enter the email address below to send the form to: */ $email = "me@mymail.com"; /* Enter the continue link to offer the user after the form is sent. If you do not change this, your visitor will be given a continue link to your homepage: If you do change it, remove the "/" symbol below and replace with the name of the page to link to, eg: "mypage.htm" or "http://www.elsewhere.com/page.htm" */ $continue = "/"; /* Step 3: Save this file (FormToEmail.php) and upload it together with your webpage to your webspace. IMPORTANT - The file name is case sensitive! You must save it exactly as it is named above! Do not put this script in your cgi-bin directory (folder) it may not work from there. THAT'S IT, FINISHED! You do not need to make any changes below this line. */ // Send email $name = stripslashes($name); $comments = stripslashes($comments); $subject = "FormToEmail Comments"; $message = "From: $name\nEmail address: $formemail\n\n$comments\n\n------------------------------------------------------------------\nThanks for using FormToEmail from http://www.ScriptsThatWork.com\n---...---------------"; $headers = "From: " . $formemail . "\n" . "Return-Path: " . $formemail . "\n" . "Reply-To: " . $formemail . "\n"; mail($email,$subject,$message,$headers); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>FormToEmail from ScriptsThatWork.com</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <meta http-equiv="Content-Language" content="en-uk"> </head> <body bgcolor="#ffffff" text="#000000"> HI <font face="arial"> <object><center> <h1>Thank you <?php print "$name"; ?>!</h1> <h2>Your form has been sent</h2> <h3><a href="<?php print "$continue"; ?>">Click here to continue</a></h3> <b>FormToEmail</b> by <a href="http://scriptsthatwork.com">ScriptsThatWork.com</a> </center></object> </font> </body> </html> |
|
#4
|
|||
|
|||
|
Is this a bug...? Anyone else having this prob...?
|
|
#5
|
|||
|
|||
|
CyCo,
What version of PHP are you running? Also, do you have register_globals set to "ON" or "OFF" in your PHP.INI file? |
|
#6
|
|||
|
|||
|
Hi,
I'm running PHP Version 4.2.3 Yes, register_globals = On, but I must tell you I tried Off as well. But, now that I think about it, I don't know if I restarted the server after that.(in Off mode) That "would" require a restart of the server to take effect, wouldn't it...? |
|
#7
|
|||
|
|||
|
Yeah, if you change any settings in the INI file, you need to restart...
But you should be aware, that if you turn register_globals OFF, you will not be able to reference your form variables in the script using $formemail, etc... You'll have to make use of the superglobal arrays... So you can create new variables in the script and assign them the value of the superglobals, or just use them directly when referring to the values in your script: option 1: PHP Code:
Option 2: PHP Code:
Hope that helps... |
|
#8
|
|||
|
|||
|
FrankieShakes
Thanx for your help. Much appreciated. |
|
#9
|
|||
|
|||
|
Anytime... Glad I could help!
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > PHP Mail |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|