Jump to content
xisto Community
sherifmayika

Mail Sever In PHP Script

Recommended Posts

While testing an an autoresponder script I am geting am eoor message like this.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 D:\Program Files\xampp\htdocs\responder\do_signup1.php on line 23any kind of help would be apreciatedthanks sherif

Share this post


Link to post
Share on other sites

Your mail() function is probably turned off. As for how to fix it, I have no clue.
Sorry :)

Have a look in cpanel, in order to see if your smtp things are all configured and seem ok.

Share this post


Link to post
Share on other sites

I suppose this is directly on your computer, right? Not a remotely controlled server/web host?If this is on a web host then they may have disabled the mail() function for security or something. I really can't get you past there.

Share this post


Link to post
Share on other sites

I assume that you are running your own webserver locally right???? well, this problem is because in windows you dont have a mail server installed by default -well not on the non server versions- you use a smtp server to send your mails like the one that comes with the IIS package, so, if i'm correct you have 2 options:

Install and configure the SMTP server of the IIS package.

Download, install, configure and run one free mail server like ARGOSOFT, download here.

A few months ago, i try this last one, its very easy to install and configure also very simple to administer, and even it works with Dynamic DNS, so if you have a broandband connection at home you can use it as your mail server too.

 

Best regards,

Share this post


Link to post
Share on other sites

The issue does indeed to be that of the lack of SMTP on Windows. (As evidenced by the issue of the D:\ drive, which is a Windows designator). Once you install an SMTP program on windows, you must also tell PHP what ports it uses and the like. This is why the error mentions the php.ini file. Both the SMTP variable and the sendmail_from variables should be set, although PHP will probably work with mail() once you have installed the SMTP program without adjustment. The adjustments simply make sure the proper from address and server address are associated with mailings.~Viz

Share this post


Link to post
Share on other sites

Your problem seems happen to me. But it was about 2 years ago when i start to learn PHP. When i saw this error message:

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 I:/Apache2/htdocs/project/testmail.php on line 5

I think that error happens because i didnt connect to internet. But I was wrong, this error message is appears because we haven't install a SMTP server on our computer. If someone on you using linux, you may never seen this error because linux has built-in SMTP server like sendmail or postfix.

If you are using MS Windows, i highly suggest to use hMailServer as your SMTP server. It small, powerfull, easy to use and open source!. hMailServer can handle most email server like SMTP, IMAP, and POP3. For saving and storing data hMailServer bundled with MySQL server. But if have already install MySQL you can configure it when instalation. You can also use MS SQL server as database server.

After installing hMailServer you can test it to check wheter it have configured well or not by using Outlook Express or other email client program.

Hope's Help! :)

Share this post


Link to post
Share on other sites

you may never seen this error because linux has built-in SMTP server like sendmail or postfix.

Of course, Linux has these server, but nobody installs them. When I install a Linux workstation, I do not install the server rpms.

Share this post


Link to post
Share on other sites

Your problem seems happen to me. But it was about 2 years ago when i start to learn PHP. When i saw this error message:I think that error happens because i didnt connect to internet. But I was wrong, this error message is appears because we haven't install a SMTP server on our computer. If someone on you using linux, you may never seen this error because linux has built-in SMTP server like sendmail or postfix.

If you are using MS Windows, i highly suggest to use hMailServer as your SMTP server. It small, powerfull, easy to use and open source!. hMailServer can handle most email server like SMTP, IMAP, and POP3. For saving and storing data hMailServer bundled with MySQL server. But if have already install MySQL you can configure it when instalation. You can also use MS SQL server as database server.

After installing hMailServer you can test it to check wheter it have configured well or not by using Outlook Express or other email client program.

Hope's Help! :)

First time i hear about this mail server, for a while i use the Argosoft Mail Server as i said in a previous post with good results, i search it to download and will test it to see how fine it works. Two things i like are that it is opensource :D and second the fact that this mail server uses a database to store and saving data.

Here you can find the hMailServer

Best regards,

Share this post


Link to post
Share on other sites

I think its simply better to use the SMTP server that comes with Windows. Just goto your control panel > add remove applications > Windows components and then look out for IIS. Inside IIS you will find SMTP. Tick it, put in ur windows CD Rom, and then click ok. Everything will install properly if done properly :)

Share this post


Link to post
Share on other sites

I think its simply better to use the SMTP server that comes with Windows. Just goto your control panel > add remove applications > Windows components and then look out for IIS. Inside IIS you will find SMTP. Tick it, put in ur windows CD Rom, and then click ok. Everything will install properly if done properly :)


He is using xampp, it has a mercury mail server, there are a lot of manuals outhere to enable and configure this mercury server..

one thing to be sure.. you need 3 ports to be open to recieve emails and 1 or 2 ports for sending.. i was not sure about this one..

on the IIS.. can this IIS smtp give access to php and apache? i have not tried that one..

********************************************

I have a perfect method on how to enable email sending without using any smtp.. though you need to add phpmailer into your software package.. or i can also give the direction directly..

be sure to have email and be sure to test your site in SSL mode.. https:// version
Gmail requires you to be in SSL and you are required to connect to ssl://mail.gmail.com

been using this one here..

Share this post


Link to post
Share on other sites

I think its simply better to use the SMTP server that comes with Windows. Just goto your control panel > add remove applications > Windows components and then look out for IIS. Inside IIS you will find SMTP. Tick it, put in ur windows CD Rom, and then click ok. Everything will install properly if done properly :)

You are right if done properly it will install properly but this doesnt means that it will work properly and based on my experience i really dont recommend this SMTP server because it is a bit difficult to admin and use it.

He is using xampp, it has a mercury mail server, there are a lot of manuals outhere to enable and configure this mercury server..
one thing to be sure.. you need 3 ports to be open to recieve emails and 1 or 2 ports for sending.. i was not sure about this one..

on the IIS.. can this IIS smtp give access to php and apache? i have not tried that one..

********************************************

I have a perfect method on how to enable email sending without using any smtp.. though you need to add phpmailer into your software package.. or i can also give the direction directly..

be sure to have email and be sure to test your site in SSL mode.. https:// version
Gmail requires you to be in SSL and you are required to connect to ssl://mail.gmail.com

been using this one here..

Can you please show us or post an URL to view how you do it??? i think that it will be very helpful for many people.

Best regards,
Edited by TavoxPeru (see edit history)

Share this post


Link to post
Share on other sites

Have a look in cpanel, in order to see if your smtp things are all configured and seem ok.


as this person says if you have not checked your control panel then do so thats the first thing to check then if thats all fine im sorry i know no more on the matter

Share this post


Link to post
Share on other sites

You are right if done properly it will install properly but this doesnt means that it will work properly and based on my experience i really dont recommend this SMTP server because it is a bit difficult to admin and use it.Can you please show us or post an URL to view how you do it??? i think that it will be very helpful for many people.

Best regards,


i think i may need to write a tutotial about this..

the stuff you need are..
a locahost that can support ssl serving.. xampp will do or install mod_ssl on your local machine
a working gmail account
most important is an internet acount..

the method uses the same technique that outlook and other mailler programs do.

i will post the link here after i finish the tutorial..
**********

this is not a perfect solution but good for testing emails.. you also need to play around with your apache and php.ini configurations..

**********
EDIT
you can send Private Message if you want me to send the solution to you or ask questions on bout the trick. till here, i can only write the tutorial every sunday.. im pretty occupied as of now.. :P
Edited by vhortex (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.