GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 31-Aug-2006, 11:25
mrjameer mrjameer is offline
New Member
 
Join Date: Aug 2006
Posts: 19
mrjameer is on a distinguished road
Exclamation

php mail


hi


when i execute a mail program iam getting some error as follows

Warning: 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:\appserv\www\mails.php on line 20

what is the solution to this problem

code

PHP Code:

<?php
// Target email address.
$to="webmaster@localhost";

// Your subject.
$subject="Test Email";

// Sender. You may put the sender's email address after "from:". This example file use "info@phpsimple.net"
$mail_from="from: [email]info@phpsimple.net[/email] \n";
// Set this email to HTML email format.
$mail_from .="Content-Type: text/html; charset=utf-8 \n";

// Your message.
$message="Hello, This is your test email.<br>
Your email server is working now!
";

// Send email.
$sentmail = mail($to,$subject,$message,$mail_from);

// If your email succesfully sent.
if($sentmail){
echo "Email has been sent.";
}
else {
echo "Cannot send email.";
}
?>



thanks
mrjameer
Last edited by LuciWiz : 31-Aug-2006 at 12:06. Reason: Please insert your Php code between [php] & [/php] tags
  #2  
Old 01-Sep-2006, 03:03
Napsty Napsty is offline
New Member
 
Join Date: Aug 2006
Location: Switzerland
Posts: 3
Napsty is on a distinguished road

Re: php mail


What OS are you using? Windows, Linux, ...?

Did you check if SMTP/Maildaemons are started?
  #3  
Old 01-Sep-2006, 03:17
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough

Re: php mail


I am basing my suggestion on your error message only.

I think you need to complete the [mail function] settings in your php.ini file. For example, in my development server, a Windows XP machine, this is what I have (where 'streamyx' is my ISP):

Code:
;... [mail function] ; For Win32 only. SMTP = smtp.streamyx.com smtp_port = 25 ; For Win32 only. sendmail_from = example_my_name@streamyx.com
  #4  
Old 11-Sep-2006, 14:20
watchdoghosting watchdoghosting is offline
New Member
 
Join Date: Sep 2006
Posts: 9
watchdoghosting is on a distinguished road

Re: php mail


JdS is correct. Specify your mail server in your php.ini settings and everything should work after a successful definition.

HTH
 
 

Recent GIDBlogNARMY by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
RESELLER WEB HOSTING - $9.99/MONTH For 4GB HD & 30GB BW! CPanel, PHP, MySQL & MORE! IncognitoNet Web Hosting Advertisements & Offers 0 30-Jan-2005 21:46
RESELLER WEB HOSTING - $9.99/MONTH For 4GB HD & 30GB BW! CPanel, PHP, MySQL & MORE! IncognitoNet Web Hosting Advertisements & Offers 0 11-Nov-2004 19:51
PHP mail() not working sajuat MySQL / PHP Forum 1 22-Jul-2004 07:10
Reliable Hosting $2-$8/month: PHP, MySQL, FrontPage, CGI, SSH, FTP, POP3, Web Mail fcolor Web Hosting Advertisements & Offers 0 04-Nov-2003 06:03
600MB Space, 20GB Banwidth, PHP, MySQL, CGI, SSH, FrontPage, FTP, POP3, Web Mail fcolor Web Hosting Advertisements & Offers 0 08-Aug-2003 10:11

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 02:31.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.