473,386 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Failed to connect mail server

25
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:\Apache2.2\htdocs\mail.php on line 7


i changed in php.ini

SMTP=192.168.1.50
smtp_port=25

;for win32 only
sendmail_from = email_removed@your_domain.com

here 192.168.1.50 is the ip address of internal mail server


i wrote code like this

=================
Expand|Select|Wrap|Line Numbers
  1.  <?php
  2. $to = "email_removed@your_domain.com";
  3. $subject = "Test mail";
  4. $message = "Hello! This is a simple email message.";
  5. $from = "mahesh.reddy@shantasoft.com";
  6. $headers = "From: $from";
  7. mail($to,$subject,$message,$headers);
  8. echo "Mail Sent.";
  9. ?>

please help me

thanks & regards

Madhu
Aug 16 '07 #1
4 2637
hi
i guess u hav to set the path to your mail server isn't functioning .
I had this same problem but after setting the path correctly it worked. Also make sure that some mail server's need authentication. then u have to authenticate by using valid user name and a password. to do that u can write a simple code like this.
Eg:-
$headers = array ('From' => $email,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));

$mail = $smtp->send($to, $headers, $message);
Aug 16 '07 #2
Nert
64
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:\Apache2.2\htdocs\mail.php on line 7


i changed in php.ini

SMTP=192.168.1.50
smtp_port=25

;for win32 only
sendmail_from = mahesh.reddy@shantasoft.com

here 192.168.1.50 is the ip address of internal mail server
Try to change the value of your SMTP in your php.ini, put the domain name of your mail server, for example " mail.example.com "
Aug 16 '07 #3
ak1dnar
1,584 Expert 1GB
  • Please Do not post your email address with your code snippets when posting in Technical Forums like Php-Forum. You may better to use some sample email address or domain name when it needs.
  • Please Use the [code=xxx] Tags.
Aug 16 '07 #4
ak1dnar
1,584 Expert 1GB
Hi Madu,
You Have to Configure your php.ini File with a real SMTP server value.
Aug 16 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Paolo | last post by:
Hi everybody, I'm a newbie using PHP4 and Apache 1.3 on Win98. When I launch a script just having this instruction: mail ("test.address@example.com", "My Subject", "My message"); I got this...
0
by: Lori McDonald | last post by:
I have code that I am using to sent an HTML email. (see code below) Intermittently I am getting the following error when I try and send an email message from ASP.Net code on my server. 80% of the...
1
by: Sudhan | last post by:
When i am trying to send in asp.net i am geting this Error Message:Transport Failed to connect to the Server. I am using SMTP server in my localMachine and Sify connction I am New to ASP.Net MY...
0
by: Mary | last post by:
I have set up an application server for .NET web applications on a new 2003 virtual server. Suddenly I am getting the following: COMException (0x80040213): The transport failed to connect to the...
0
by: Hawksey | last post by:
Hello, Has anyone else experienced a similar problem. We get an intermittent error trying to send mail using smtpmail. Our SmtpMail.SmtpServer is a different server to our web application...
2
by: nvduffer | last post by:
I am running IIS5 on my XP Pro home computer and am unable to send email through my ISP's mail server. In the PHP.INI are two lines: smtp = smtp.telus.net smtp_port = 25 I have opened port 25...
5
by: Nathan Sokalski | last post by:
I am attempting to send an email using ASP.NET 1.1's Mail.SmtpMail.Send() method. My code contains all of the following: Dim mailmsg As New Mail.MailMessage Mail.SmtpMail.SmtpServer =...
0
by: wizromeo | last post by:
Hello, Has anyone else experienced a similar problem. We get an intermittent error trying to send mail using smtpmail. Our SmtpMail.SmtpServer is a different server to our web application...
2
by: jephperro | last post by:
Hi there, I have a problem using PHPMailer. On my local development machine, the script works fine and sends emails. On amy staging server, when I try to use PHPMailer to send() I see the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.