Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost"
Old 09-29-2010, 02:00 AM Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost"
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Hi Forum,

I am having an error in my php code, as I am trying to send email using mail() function.

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

Any of your help would be highly appriciated.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-29-2010, 07:48 AM Re: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost"
Ultra Talker

Posts: 366
Name: Steve
Location: Miami, FL, Earth
Trades: 0
create a new page like so:

<?php phpinfo(); ?>

Then load up that page and look for your mail settings. Should be using sendmail. You may not have anything configured. If it looks right, maybe you have port 25 closed on your server for security. You'll have to configure that from command line.

http://www.electrictoolbox.com/artic...mail/iptables/
__________________
- Steve

President,
Please login or register to view this content. Registration is FREE
smoseley is offline
Reply With Quote
View Public Profile Visit smoseley's homepage!
 
Old 09-29-2010, 08:21 AM Re: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost"
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
thanks smoseley

do i need to change these given below (it is viewable at my phpinfo page):

sendmail_from no value no value sendmail_path no value no value

in php info.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 09-29-2010, 08:24 AM Re: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost"
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
I am also trying this to send email:

PHP Code:

ini_set
"sendmail_from""info@domain.com" );
    
ini_set"SMTP""mail.myserver.com" );
    
ini_set("smtp_user","myusername");
    
ini_set("smtp_pass","password");
    
ini_set"smtp_port""25" );
    
$msg $_POST['info'];
    
$em $_POST['email'];
    
$nm $_POST['name'];
    
//die;
    
$email      'me@gmail.com';
    
$subject 'A quote from user.';
    
$message $msg."&nbsp;".$em."&nbsp;".$nm;
    
//echo $message;
    //$headers  = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    
    
if ( mail($email$subject$message"From: $email") )
    echo 
"The email has been sent!";
    else
    echo 
"Error sending email!"
I hope it will help you to know my problem.

I've also put php.ini in my root folder.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 09-29-2010, 09:19 AM Re: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost"
Ultra Talker

Posts: 366
Name: Steve
Location: Miami, FL, Earth
Trades: 0
Try getting rid of these lines and see what happens:


ini_set
( "sendmail_from", "info@domain.com" );
ini_set( "SMTP", "mail.myserver.com" );
ini_set("smtp_user","myusername");
ini_set("smtp_pass","password");
__________________
- Steve

President,
Please login or register to view this content. Registration is FREE
smoseley is offline
Reply With Quote
View Public Profile Visit smoseley's homepage!
 
Old 09-30-2010, 01:05 AM Re: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost"
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Hi Smoseley,

I disabled these and result is:

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

Please let me know if there's something I need to change in php.ini

Your help is really appreciable.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 09-30-2010, 03:13 PM Re: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost"
Ultra Talker

Posts: 366
Name: Steve
Location: Miami, FL, Earth
Trades: 0
As above:
Quote:
Originally Posted by smoseley View Post
maybe you have port 25 closed on your server for security. You'll have to configure that from command line.

http://www.electrictoolbox.com/artic...mail/iptables/
__________________
- Steve

President,
Please login or register to view this content. Registration is FREE
smoseley is offline
Reply With Quote
View Public Profile Visit smoseley's homepage!
 
Old 10-01-2010, 02:56 AM Re: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost"
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Thanks smoseley,

Now error is:

Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in

Headers I used
PHP Code:
$headers.= "";
    
$headers.="MIME-Version: 1.0\r\n";
    
$headers.="Content-type: text/html; charset=iso-8859-1\r\n";
    
$headers.= "Content-Transfer-Encoding: quoted-printable";
    
$headers.= "From:info@mywebsite.com \r\n"
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Old 10-01-2010, 07:02 AM Re: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost"
Novice Talker

Posts: 7
Name: Nguyen Van Thu
Location: Viet Nam
Trades: 0
I tested send mail from localhost. I saw it only send to gmail success, don't success other mail box

Notes: I using xamp.
__________________

Please login or register to view this content. Registration is FREE
ngockhoa is offline
Reply With Quote
View Public Profile Visit ngockhoa's homepage!
 
Old 10-01-2010, 10:16 AM Re: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost"
Ultra Talker

Posts: 366
Name: Steve
Location: Miami, FL, Earth
Trades: 0
Try adding this at the top of your script and see if it makes a difference:

PHP Code:
ini_set("sendmail_from","info@mywebsite.com"); 
__________________
- Steve

President,
Please login or register to view this content. Registration is FREE
smoseley is offline
Reply With Quote
View Public Profile Visit smoseley's homepage!
 
Old 10-02-2010, 01:16 AM Re: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost"
Isabella_Smith's Avatar
Ultra Talker

Posts: 285
Trades: 0
Thank you all,

But no success, do I need to contact my hosting service providers..???

What to ask them??
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE



Please login or register to view this content. Registration is FREE
buy all indian salwar Kameez, Sarees and clothes
Isabella_Smith is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost"
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.47209 seconds with 12 queries