sending email script

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
myasirm
Forum Commoner
Posts: 54
Joined: Sat Sep 12, 2009 3:57 am

sending email script

Post by myasirm »

hi guys i want to send email from my page i have taken this code as sample and i create mailform.php page as blank so when i click on submit button i am not getting any email in my email inbox kindly help me in this regards if any one know

thanks in anticipation.

<html>
<body>

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
{
//send email
$email = $_REQUEST['email'] ;
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail( "someone@example.com", "Subject: $subject",
$message, "From: $email" );
echo "Thank you for using our mail form";
}
else
//if "email" is not filled out, display the form
{
echo "<form method='post' action='mailform.php'>
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>";
}
?>

</body>
</html>
myasirm
Forum Commoner
Posts: 54
Joined: Sat Sep 12, 2009 3:57 am

Re: sending email script

Post by myasirm »

guys i am getting this warning massage



Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\softwareComp\complain_msg.php on line 77
Thank you for using our mail form
myasirm
Forum Commoner
Posts: 54
Joined: Sat Sep 12, 2009 3:57 am

Re: sending email script

Post by myasirm »

8O
myasirm
Forum Commoner
Posts: 54
Joined: Sat Sep 12, 2009 3:57 am

Re: sending email script

Post by myasirm »

:?:
manojsemwal1
Forum Contributor
Posts: 217
Joined: Mon Jun 29, 2009 4:13 am
Location: India

Re: sending email script

Post by manojsemwal1 »

Check in your server smtp has configured or not.
myasirm
Forum Commoner
Posts: 54
Joined: Sat Sep 12, 2009 3:57 am

Re: sending email script

Post by myasirm »

dear from where i can check my smtp server and what changes are required to work this emailing program

kindly help me in this regards it is very important for me

thsnks
myasirm
Forum Commoner
Posts: 54
Joined: Sat Sep 12, 2009 3:57 am

Re: sending email script

Post by myasirm »

?????
xiaolin
Forum Newbie
Posts: 1
Joined: Mon Jan 04, 2010 4:17 am

Re: sending email script

Post by xiaolin »

if you want to send email from your local host, you should config smtp. there is no error if you send mail from webhost.
myasirm
Forum Commoner
Posts: 54
Joined: Sat Sep 12, 2009 3:57 am

Re: sending email script

Post by myasirm »

from where i config smtp server ?
manojsemwal1
Forum Contributor
Posts: 217
Joined: Mon Jun 29, 2009 4:13 am
Location: India

Re: sending email script

Post by manojsemwal1 »

which server u r using LAMP or WAMP for sending email your server has to be configured as mail server
if mail server is configured so open php.ini file and find smtp and put smtp server ip or port.
myasirm
Forum Commoner
Posts: 54
Joined: Sat Sep 12, 2009 3:57 am

Re: sending email script

Post by myasirm »

yes im using WAMP kindly tell me what should i write in php.ini file?
myasirm
Forum Commoner
Posts: 54
Joined: Sat Sep 12, 2009 3:57 am

Re: sending email script

Post by myasirm »

in php.ini file only two times smtp is written now kindly tell me what changes should i do????


;extension=php_smtp.dll


[mail function]
; For Win32 only.
SMTP = localhost
User avatar
Ragnis
Forum Commoner
Posts: 31
Joined: Thu Nov 13, 2008 12:35 pm
Location: Saaremaa, Estonia, Europe, Asia, Planet Earth, The Solar System, Milky way.

Re: sending email script

Post by Ragnis »

Remove the semicolon(;)

Code: Select all

extension=php_smtp.dll
Post Reply