Sending mail from own smtp server - php

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...

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

Configure SMTP capabilities on my Apache server

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/

Sending Mail using PHP Mail function - Local mail server?

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.

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