This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Sending Bulk Emails using PHP
Is there a service out there that can handle sending emails constantly through PHP without issue? We're looking to send out 500+ emails a day or more and are worried about using the built in mail functions of PHP.
Any suggestions?
There's nothing inherently wrong with the built-in mail functions, and 500 e-mails a day is almost no load at all. PHP simply executes your configured MTA executable, such as sendmail.
However, I'd recommend using a better mail API such as Swiftmailer. This will enable you to build e-mails with HTML, attachments, and such much easier than trying to generate your own MIME messages.
For larger mail volumes, I would recommend using a 3rd party, such as MailChimp (or one of the many, many others). They're very good at keeping you off blacklists for spam and such.
500 emails/day really isn't that many. You have several options:
Send the mail yourself, from your server. You could use third party libraries to handle the multitude of options. Swiftmailer, PHPMailer etc or roll your own. Sending from your own servers, you will need to manage reverse DNS, SPF records etc and (assuming you're on Linux) will become quite well acquainted with Postfix et al.
Optionally you can use third-party services, such as http://sendgrid.com/ or http://aws.amazon.com/ses/. These are essentially pay-as-you-go mail servers with nice simple APIs. This can help with a lot of the heavy lifting involved in maintaining reliable mail servers. This gets complicated when you're sending thousands of emails per day. Throttling, queueing, load balancing etc.
Another option, if you're doing eMarketing is to use a service such as Mailchimp or Campaign Monitor. These will do all proofing, sending, throttling and reporting for you for a one-time fee.
you can use php's mail() function without any issue. but most of the shared hosting servers do not allow you send large volume emails.. You can use third party SMTP for this..
Related
I have web application, and I want to implementation email system. My web application is a social network: users receive email when users update status and any another user is commented to their status.
What is the best way to implement that? I have been implement email system after users is comment, then in the same time I'm sending email to their user. The second option to use a schedule to send email.
I am using PHP and SwiftMailer.
To clarify: should I directly sent email to users, or should I use a database to queue mail and send via cron?
Please try phpmailer library functions
You could also try PostageApp.
http://postageapp.com/
You can use inbuilt php function .Please visit the following link.
http://php.net/manual/en/function.mail.php
My advice is to use a mailing service with an API, such as Sendgrid for large amounts of mails (>100 per day), and otherwise just use your php mailer of choice.
Sending mail via your own server has a couple of disadvantages, mainly related to getting blacklisted or marked as spam. This is because the other mail servers don't really know yours, and if suddenly a lot of mails start appearing, you look like a spambot.
To avoid sending a lot of mails at once, you also have to somehow queue the sending via batches, and for that you need cron jobs and such. Getting un-blacklisted is also not very easy, and simple domain changes will probably get you re-identified
Mailing services do relieve you of most of these problems, and are overall reasonably cheap. Learning the pitfalls of in-house mail solutions is usually too much for a single project, since it is a reasonably large topic.
Disclaimer: I do not work for any mail-sending service, I just happen to work in a place that had their domain blacklisted recently because of bad emailing practices.
I have developed a CRM that is used with a marketing website similar to manta.com. The CRM has a built-in email client. Basically it matches names and emails to addresses on file, and if the email is from a customer it loads their account information next to the email.
The entire system works, but is in some cases slow. Because each "region" of the country is managed by a different company, the software connects to several different mail servers, all of which behave differently.
In some cases (mostly with godaddy servers) it takes a very long time to send an email. It also takes a long time to load the inbox if they have a lot of messages (500+), even if it is paged.
I am using pear Mail::Factory smtp to send, and the built in php imap functions to receive.
I am thinking for outgoing messages I will just store the emails into a db and then have a cron script send it out, then they can send their email and move on right away.
Does anyone have any ideas/concepts for handling large inboxes via IMAP and php? I will have no control over the mail servers themselves, but have full control over the server that the CRM is on.
I am not looking for code, just concepts if you have them.
It is Linux (ubuntu), apache, mysql, php. I can use Zend if needed.
It looks like a combination of caching the emails and using the imap_fetch_overview function which omits the body of the email. This seems to eliminate any issues with the lag. I can also use it to page the results so I am only loading a small number (25-50) at a time. Thanks for the help.
I am developing a social networking site. It has functionality like user registration, people exchanging messages and sending email notifications for people's actions (and many more).
Currently I use PHP's mail function to send mails and it is working fine. I already set up a VPS and hosted the application.
My question may be a dumb question. Do Facebook and other social networking sites use SMTP servers to send the notifications or only just any kind of PHP mail function?
I read somewhere that using PHP's mail, there is a chance of mail going to SPAM folder. They advised using a certified SMTP server.
So, if I have to use an SMTP server:
1) Do I have to purchase a certified SMTP server separately? Or can this be hosted on same VPS whatever I have. If so, what server software will be good for this?
2) Are there settings I have to do in SMTP servers like send unlimited messages, because we don't know how many people exchange emails in a minute, and that is totally random.
To start: you are definitely going to have to use an SMTP server to send the emails from PHP. You can't simply throw your emails at the mail() function and expect it to work. You have to connect it to an SMTP server that does all of the dirty work.
However, if it's not your domain, I would suggest you don't do it. If you have the time to learn the ins and outs of email delivery and want to set up and maintain an SMTP server, by all means, go ahead.
If you'd rather focus on building your app and not worry about your emails getting delivered, I'd suggest an email delivery service. Here's a good list of services to check out:
PostageApp
Sendgrid
Postmark
Mailjet
And there are plenty more out there. All of them have a free option for you to play around with, so just look for the one that fits your needs and requirements.
(FULL DISCLOSURE: I am the Product Manager of PostageApp. Happy to answer any questions you might have about sending email from your app, though!)
The issue here is not really with the mail() function in itself, but in how you construct the emails. Messages can be treated as spam for a million and one reasons, but it is generally accepted that if you use one of the tried and tested mailer libraries, like Swiftmailer or PHPMailer (both free) there is marginally less chance of your messages being treated as spam.
Whether your messages get treated as spam is far more about how you construct your messages than how you send them. Another major factor is if your server sends thousands and thousands of emails all the time, so another hint is to be sparing with the emails you send out - only send them when you actually need to.
If you really want to know the answer to this question, you should do some reading on exactly how the modern email system works. Being able to build and send good emails is all about knowing how to work the system. Start here.
I'm in the process building a web application which is has a potential to send thousands of email on daily basis (most of it is system notification emails)
I'm using dedicated server for start but I'm thinking to use such as a smtp server to handle the sendmail process. Not just to reduce the server load but the most important thing is I don't wan't my server IP blacklisted in any spam list such as spamhaus.org
Can you suggest me what the best deal for this situation?
Options that I have so far are :
Using goggle app smtp with premier account. This is the option I prefered but I'm not sure whether google has such limitation that does not fit my situation
Using commercial smtp server (If this the best option, can you suggest me any reliable service for this?)
I would recommend a commercial solution because then your taken out of the maintenance and if you do get blacklisted you can enlist their support team to take care of it.
I've used campaign monitor and had very good success with them. The rates are comparable and the interface is very easy to use. This is more of a small business solution.
I've also used Responsys and Yesmail. These are more enterprise solutions and might be a little overkill for what your looking for.
Regarding black lists: if you are cautious, and do not do silly things, like sending 5000 mails once on a fresh IP address, than you will not be blacklisted. For the case of accidental blacklisting you should have a reserve IP address or a reserve server.
A few thousand mails is not a noticeable load on modern hardware. Just think about it: if you send 5000 mails per day that means only a single mail per 17 seconds.
That said I am not against using an external mail service for sending notifications at all, I just have no such experience.
I have a website that receives incoming emails via cloudmailin, adds the content to the database, and then sends a confirmation email back to the person who sent the email. Currently I'm using a php mail() function to send the reply, but it seems to take about 1.5 min to actually get to the user's inbox. Is there a way to make this more instantaneous? I'm currenly hosting the application on FatCow, and I'm sure it has to do with their mail server, but I don't really know much about how that works and am wondering if I have to change hosts to accomplish faster delivery times or if I can do anything about it without switching.
mail() is a black box. You're telling PHP to try sending a mail however the host has configured PHP to do so.
It's very likely that it's just calling sendmail in your case. It's also very likely that the mail queue on that machine isn't the fastest in the world. Shared hosting machines are often overloaded.
The very first thing you should do is ask your host about the mail delay. Perhaps something is wrong, and they can fix it. Or they might just tell you that a minute and a half is not a long time to wait.
There are lots of other options, mostly in the form of companies that provide an SMTP service to you. I can't recommend one, but I can recommend that you pop over to your favorite search engine and look for "smtp service." I've recently starting working with Amazon Simple Email Service. It's supposed to be fast and well-maintained, and it's certainly inexpensive.
All of those options are likely going to require some configuration changes on your end. For example, you'll want to set up custom DNS records (for DKIM and SPF) to ensure that mail from a third party provider isn't automatically flagged as spam.
Using SMTP with PHP is dead easy. There are plenty of mail generating options out there. My personal favorite is SwiftMailer. It even has a transport option for Amazon SES.
The final option, of course, is grabbing your own virtual private server or dedicated server, which will let you configure outgoing mail as you desire, at the cost of needing to know how to maintain that server.
Edit: Obligatory link to relevant Coding Horror post.