Getting mail() function to work in XAMPP...?
Moderator: General Moderators
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Getting mail() function to work in XAMPP...?
For development purposes I'm trying to get the mail function to work in XAMPP on my local server. The issue is that I haven't found any clear explanations of how to do this online. Usually most modules require simply uncommenting something in the php.ini file and restarting Apache. I have read online that some people think there are more efficient ways to do mail however I simply need to be able to have my system send an email out to my address on the internet and nothing else at this time. So KISS policy here please. 
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Getting mail() function to work in XAMPP...?
I tried getting email to work on my local machine and encountered several issues, mostly because of the complexity behind setting up email. It's probably one of the hardest services I have ever dealt with (although I am no Linux expert, LAMP is a breeze compared to Postfix, Sendmail, etc).
Basic setup and configuration on a live server is easy but if you are trying to set one up on a local development server you are likely going to have to jump through hoops to get it to work as expected.
I never did get mine working, instead I opted to use SwiftMailer and connect to remote GMail SMTP account (which I would recommend you do anyways for the later flexibility).
One of the issues with hosting locally is the fact that all AFAIK email MTA's require your server to have a recognized domain associated with it. This is difficult to achieve for a local machine, because:
1) You are likely behind a router -- I was anyways
2) You do not have a static IP
You need to register a domain name for your server and when it's behind a router you need to open all the required ports and enable the right services.
Mapping a domain to your local machine I couldn't figure out (or rather I gave up after reading about DNS). A domain with GoDaddy.com I believe requires two DNS which I don't think you will have if your hosting the website yourself internally on a local machine.
You might be able to use a service like DynIP or EasyDNS to solve the above issue. If memory recalls they offer tools you install locally which monitor your IP address and notify their servers when you IP changes so the domain is constantly reflecting the proper IP address.
Once you have a registered domain mapped to your local machine, you might then be bale to setup a postfix system, because the basic configuration is a breeze.
Now that I'm thinking about it...all of the above might not be necessary you might be able to setup a local delivery only, but if your tried to send to a machine outside your network, I think at that point you need a registered domain name as incoming MTA's probalby won't accept email from a non-recognized domain -- I assume so anyways.
Anyways, this is where things get complicated due to the varied nature of email system. I would strongly suggest just using SwiftMailer and setting up a GMail account and testing emails that way. It's much easier and at least then you have Chris to help you out when things go poof.
Basic setup and configuration on a live server is easy but if you are trying to set one up on a local development server you are likely going to have to jump through hoops to get it to work as expected.
I never did get mine working, instead I opted to use SwiftMailer and connect to remote GMail SMTP account (which I would recommend you do anyways for the later flexibility).
One of the issues with hosting locally is the fact that all AFAIK email MTA's require your server to have a recognized domain associated with it. This is difficult to achieve for a local machine, because:
1) You are likely behind a router -- I was anyways
2) You do not have a static IP
You need to register a domain name for your server and when it's behind a router you need to open all the required ports and enable the right services.
Mapping a domain to your local machine I couldn't figure out (or rather I gave up after reading about DNS). A domain with GoDaddy.com I believe requires two DNS which I don't think you will have if your hosting the website yourself internally on a local machine.
You might be able to use a service like DynIP or EasyDNS to solve the above issue. If memory recalls they offer tools you install locally which monitor your IP address and notify their servers when you IP changes so the domain is constantly reflecting the proper IP address.
Once you have a registered domain mapped to your local machine, you might then be bale to setup a postfix system, because the basic configuration is a breeze.
Now that I'm thinking about it...all of the above might not be necessary you might be able to setup a local delivery only, but if your tried to send to a machine outside your network, I think at that point you need a registered domain name as incoming MTA's probalby won't accept email from a non-recognized domain -- I assume so anyways.
Anyways, this is where things get complicated due to the varied nature of email system. I would strongly suggest just using SwiftMailer and setting up a GMail account and testing emails that way. It's much easier and at least then you have Chris to help you out when things go poof.
- JAB Creations
- DevNet Resident
- Posts: 2341
- Joined: Thu Jan 13, 2005 6:44 pm
- Location: Sarasota Florida
- Contact:
Re: Getting mail() function to work in XAMPP...?
Gah...screw that I'm merely testing account activation. I've already been spending time migrating the test script to a private area on my live server any way. It's only a minor point that breaks local testing. Thanks for your suggestions however, I figured it would be more trouble then it's worth.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Re: Getting mail() function to work in XAMPP...?
Yea sending emials locally is... 