Configure SMTP capabilities on my Apache server - php

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/

Related

mail() not working on my virtual machine

Mail() is not working on my virtual machine.
I would like to use it for my php application. What can I do?
What settings should I configure in php.ini to have it work>
I am using sendmail and when I look at the mail logs it tells me "Connection timeout" what can I do?
Also when I do from terminal on my centos server:
telnet smtp.gmail.com 25
it blocks and doesn't output anything.
You need to setup a mail server on your machine for the mail function to work. If you are on Windows (which I am guessing) you can setup a Pegasus mail server. Connecting to either your ISPs SMTP server or GMail or whatever is the easiest route out of this one.
You need to define SMTP settings in your php.ini to talk to a mail server through which you are allowed to send outbound messages, with or without authentication.
If you are working from wamp or xamp then u have to pear mail or some other library to support your configuration. I used pear http://pear.php.net/package/Mail/ ...... it will also contain test mail sending tutorial

Mail function - change SMTP relay

I use PHP's mail function to send emails from my server, which currently also handles mail. However, I would like PHP to start sending messages through a different SMTP relay, not the server it's running on. I checked out php.ini, and it appears that it is only possible to specify a different relay on a Windows PC, whilst my server is running OS X Snow Leopard. Is it possible to change the relay settings? Ideally, I wouldn't want to incorporate anything new into my PHP code, as I use the mail function all over the place.
You cannot do this without either setting up a sendmail alternative on your server that routes mail through SMTP, or much much easier, using a library like Swiftmailer.
PHP does not have the capability to use an external SMTP server built in (Unless you are on a Windows platform).

Sending mail from own smtp server

I am working for a client who bought a server (V-Server from Strato) with IIS. I've set up a SMTP Server so I can use "mail()" from php to send mails. But everytime I am trying to send a mail, it tells me to configure my SMTP server.
I already added realys, new domains and restarted the whole thing. What can I do? I want to send them from the localhost because the server is running on the machine itself.
First of all, you need to check your mail server (SMTP Server) to confirm it is working properly. To check it manually try telnet 25 port of localhost and execute basic SMTP command to see if it accept mail relaying from your localhost. Microsoft has an article on SMTP check with telnet client, have a look if needed.
If your SMTP server is working as expected, then try debugging your php coding.
FYI: No comments privilege, had to write this as answer...

How to send a mail using xampp in windows XP?

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.

Mail() won't send in windows server2003

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

Categories