Sending Mail Through PHP With MAMP Free - php

So I downloaded the Free Edition of MAMP free, and found out that it doesn't initially allow sending mail through PHP.
My question is very simple. What is the best and easiest way to enable it?
Thanks in advance.

This is probably not really the answer you are looking for, but if you're set on sending emails try a program like https://github.com/PHPMailer/PHPMailer
it will enable you to send emails through an SMTP server (like gmail). It will make sure your emails get delivered while working on localhost. When going live you could tell it to use PHP mail in the config (which is actually never recommended because of the spam factor and limited functionality).
That being said, while on localhost it shouldn't be necessary to send emails. Being that localhost usually implies a staging/development surrounding. What I like to do is output the to be sent email to my error log.
http://us3.php.net/manual/en/function.error-log.php
You can instantly tell how it looks and you get confirmation that your script has run that part.

It is not possible for you to send email from local server like WAMP,XAMP.

Related

XAMPP mailtodisk feature

This is probably a stupid question but I can't seem to find an answer anywhere. I have made a PHP mail script on localhost and I need to test it, all the emails are being forwarded to the 'xampp/mailoutput' file and I can view them as .txt files. Does this mean that my script is working fine? Or do I need to set up a tool such as 'TestMailServerTool' to test properly.
Yup If you're getting mail output that means php is sending emails successfully.
If you want to get proper email functionality you have to setup an SMTP server in your Windows System. You can also use other SMTP servers like gmail, yahoo or use one which is provided to you by your ISP or your Web Hosting providers.

How to get the Reply Emails ? Need a Mail Server?

As i'm knowing just about PHP and don't know at all about Mail Servers, what i want to know here is:
How can i get the "Replied" emails (from the receivers) for the mails i've send (by using PHP, with a address like xxxxxxx#gmail.com)
Does it need to setup my own Mail Server?
Unless using own Mail Server, is there any other easy way?
Honestly i'm not well understanding over IMAP or Email Protocols. Doing setup my own IMAP Server is far worse. Can it be done simply with a Web Hosting which supporting IMAP protocol? Or do i need to setup manually out from the start?
To be brief, i need a simple guide.
You only need a mail server if you don't already have a place where those reply-tos end up. Which adress are you sending them as? Where would you fetch the emails for those adress? You can ask PHP to log into any mail server that you'd fetch your emails from manually as well, so there shouldn't be a problem. But maybe I'm not getting you right.
Simply put the reply address to an email you own. For the example you gave to work, you would need to have the xxxx#gmail.com account.
Most people use something along the lines of mailer#youdomain.com, ans then create an account for that on their ma8lserver.
If you want to use your own domain, you don't need to run your own mailserver. Gmail, hotmail, and others have services that let you use their mailservers for your fomain, for free.

How can I send mail with PHP's mail() function and MAMP Pro?

I'm developing a website that will utilize PHP's mail() function. I'm running MAMP Pro (primarily because it has the Postfix feature that is supposed to be useful for sending emails). I feel like I've tried everything, but my program still won't send emails. It doesn't even really matter to me that I use mail(). I just want to be able to send emails from my local MAMP Pro webserver so I can test out my website. Any suggestions would be greatly appreciated!
You need to set it up for your ISP.
http://documentation.mamp.info/en/mamp-pro/server/postfix
also
http://blog-en.mamp.info/2009/09/how-to-sending-emails-with-mamp-pro.html
Other than that, I agree with the comments. What is your ISP? What is php telling you? Also, read your logfile for postfix and tell us what it says:
http://blog-en.mamp.info/2010/03/how-to-show-postfix-log-file-of-mamp.html

Which email service shall I use for testing sending emails?

I'm coding in PHP w/ CodeIgniter and I'd like to test some of the features in my app that send emails.
For some reason, I couldn't send emails through my email account in my local server (XAMPP), and I also don't want some SPAM filter to think I'm spamming while I'm testing.
So is there any email service that I can use for testing purposes? preferably one that doesn't enforce SSL, since I have problems getting that to work on my local server.
Appreciate your help.
As long as you're not sending out dozens or hundreds of test E-Mails, use whatever your everyday E-Mail provider is (e.g. GMail). Set the SMTP server of your mailing function to point to Google's. (I think SSL is optional with GMail, but I may be wrong.)
If your mailing library doesn't support using an external SMTP server, switch to a different one. But I think CodeIgniter has you covered there.
If you just want to test the application functionality, check out Papercut. This utility simulates the sending of email without having to set up a mail server, works great!
edit: had wrong link.
I like to set up a test SMTP service on my development machine and just send to that. There are several good options listed under this question.

A couple problems re: CodeIgniter emailer

I have some problems with the email system for CodeIgniter:
First, the emails I send out (registration, confirmations) are getting caught in standard spam filters in gmail and other mail clients. How do I get around this? How do companies like Facebook get their emails through consistently?
Second, the mailer is working locally but once we deploy it it no longer runs (doesn't send emails) but all the other forms run just fine. Anyone ever run into a problem like this?
Thanks for all the help!
I can't really answer your first question - it's not specific to CodeIgniter. You just need to make sure your email doesn't look like spam. In short - there's no way of guaranteeing your e-mail will not end up in a spam filter.
As for the second question, I expect your production server needs to be configured properly for email. You probably need to configure CodeIgniter to send email properly. I would suggest setting up an SMTP server (or using an existing one) rather than using the standard PHP mail which I think CodeIgniter uses by default.
Regarding spam, most organisations are very secretive about how they prevent spam (not wanting to publish information which helps the spammers) and in some cases they don't actually know - an obvious examlpe of this is bayesian filtering - but, for example, hotmail use a completely unaccountable army of volunteers to manually classify emails.
Do and get a copy of spamassassin and try to reverse engineer how the standard rules work. Obvious things to check are:
1) AVOIDING LOTS OF CAPITALS
2) don't mention the 'V' word
3) make sure you've got a current and restrictive SPF 1.0 policy published
4) make sure your sending from an address which has A and PTR DNS records
5) Do provide a reply-to and from email address which use your domain in the address
the mailer is working locally but once we deploy it it no longer runs
doesn't send emails
Which? These are 2 totally seperate things. If the code is falling over (if so why have you not provided the error details) then its likely a PHP version issue or a problem with the connection to the MTA (or the PHP mail config).
The latter is a problem with the MTA itself.
99.9% of problems reported as PHP mail failures have nothing to do with PHP and are problems with the MTA.
Enabled detailled error reporting for your MTA and see where it is failing.
C.
You may have to configure the email on your server differently than your local development environment. I've had to in the past.
There are two basic ways that PHP can send mail:
Via a UNIX program called "sendmail" (only on non-Windows servers and only if it is installed - check with your hosting provider)
Via a SMTP server.
If you've configured CodeIgniter to use SENDMAIL, check to ensure that the Sendmail path is correct. Your hosting provider usually provides this somewhere in their online documentation.
If you're using SMTP, you need to make sure that your server can contact the SMTP server. You can do this by logging into the server via SSH and typing "telnet your.smtpserver.com 25". If you get an error message about not being able to connect, you know you have a problem with your hosting provider connecting to your mail server.
I've been able to diagnose this problem by enabling logging on my production server (http://bit.ly/4pprd6) and adding log_message('error', $this->email->print_debugger()) right after I attempt to send a message.

Categories