I am using XAMPP for localdevelopment.And I am using the mail() function for sending the mail.
But unfortunately it wont sent the mail.I am not using any SMTP server in local host.If I need to sent mail what can I do?Thanks in advance.
You need to configure your SMTP server details in your php.ini. Alternatively, you may use a mailer library like the Swift Mailer.
As Maerlyn suggests, you can add the SMTP to your php.ini file. However thing to keep in mind is that if your SMTP server requires authentication or it requires POP before SMTP, php.ini cant help you with that. If your ISP has an SMTP server and you have configured your Outlook to use your ISP email account, it will authorize your IP (for some time) to send out emails through that SMTP server so the mail() function will work.
Related
I have an Apache, PHP, MySQL combo running on my Windows 8 machine. I want to send mails using the PHP mail function but then learnt that I need an SMTP server configured. How to do this? I have Outlook installed if that info is of any use.
I used a library called "swiftmail" which can contact an external SMTP server (like gmail) and do the job. Turns out having a local SMTP server wasn't required after all.
Here is the link: http://swiftmailer.org/
I am trying to send an e-mail from localhost but am getting the error:
Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set().
Does this mean i need to set up a local mail server?? and if so how and which one is easiest.
Thanks in advance
Paul
This is what I use, but it's for testing purposes only:
http://www.toolheap.com/test-mail-server-tool/
There's almost no configuration, and I got it to work right out of the box (on Win7) after failure with several other mail servers. It does not send the actual mail, but stores it as an .eml file. This is great for testing mailing lists for instance, where you don't really want to send the 2000 emails, but want to get a realistic result from your application.
It might look like garbage, but it's been working great for me.
Yes, it does, and if you want to send mail to an outside email address (and not a user local to the system, it is annoyingly difficult).
Most hosting companies (e.g. GoDaddy) have this setup for you, so PHP's mail() function works without you needing to do anything.
If you're configuring it on your own system, you might want to consider (a) configuring sendmail to use an alternate SMTP gateway (I frequently use Gmail) or (b) a complete alternative to sendmail (Zend Mail looks promising.)
If you are using Linux, there is usually no need to set up a a mail server,
If you are using Windows, yes, you do need to set up a mail server
If you are interested in just sending mail, you can by SMTP protocol use any SMTP server. Here is a tutorial to setting up PHP to use a remote SMTP server.
Yes, you need a mail server to be able to send mail, but even if you do, you are not going to be able to send to addresses outside of you local network as mail from your computer will be blocked by all recipients for spam reasons.
You could use the pear mail function to connect to an external smtp providor like gmail to send the mails for you. More info here and here.
smtp4dev is in my opinion the best tool for capturing local SMTP traffic on Windows.
It listens SMTP on localhost port 25 and pops up a notification every time a new mail is posted (it doesn't actually forward the mail to its recipient). You can then open the message in your favorite mail agent or save it to a file.
i just installed postfix: it's sending email without any configuration by me. (I choosed no-config
setup)
Can I know why phpmailer needs a valid smpt or relay to send emails while postfix doens't?
Thanks
postfix is a mail server. phpmailer is a library to interface with a mail server.
Because postfix is a SMTP server.
Yes, well congratz, you have build yourself kind of an open relay then:)
Phpmailer needs server config as far as I could for now see when stumbling over their docs.
Postfix is a mail server which would be a layer under this, I suppose.
I am unable to send an email via php's mail function.
This is the error I receive.
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:\inetpub\vhosts\southernbatteries.com\httpdocs\includes\utils.php on line 6
Array ( [0] => [1] => Could not send mail, please try later... )
What exactly does this mean ? Does it mean there is not mail server installed on my webserver ? Is it possible to use a different mail server. E.g Gmails mail server to send the mail ?
If you want to use built-in mail(), you will need to talk to the server administrator. It is possible to use an external SMTP server on Windows, but it has to be specified in the php.ini settings, and PHP's built-in functions don't support SMTP authentication.
The usual way is to either use a local mail server that in turn can talk to a "real" SMTP server with authentication, or use a mailing package like SwiftMailer that can connect to a 3rd party SMTP server like GMail directly.
You need to have a mail server to send mails. If you only have apache, you cannot, unless you edit the php.ini file and set the smpt_server to one that allows you to do so. Note that this will only work depending on your ISP.
If you have a hosting account you can upload the files and online they will work.
You should run your own mailserver on your server. Most likely it's not started or not installed.
As I can see your are running it on windows it's most likely the later. You could try using your providers mail server. Or googles. But you need most likely a username and password for that.
you should avoid using php's mail()-function as ist connects and disconnects to the mailserver for every mail sent.
instead of that, try to use something like phpMailer wich allows easy configuration and sending a lot of mails without performance-problems.
If you want to run your own mail server (if this is a development environment for example) you could use mercury.
I installed PHP in windows server 2003. All the files are working fine except the mail issue. There is no problem in SMTP. Because I run the JSP project in the same server.In that mail function working fine. So where is the problem? And how can i manage? I set the SMTP server in PHP as
; For Win32 only.
SMTP = localhost
smtp_port = 25
Does the SMTP service need authentication? Maybe there is a setting in the JSP code which authenticates against the SMTP server? You could look at the JSP code to see if there is a different SMTP configuration.
Another reason could be that the SMTP allows only specific sender addresses/domains. Are the sender addresses of the PHP and JSP applications different?
If your smtp server is not exposed and protected behind a firewall you can allow relay and that should take care of it.
If not then verify you can send the email you want using telnet