Mass Email From dedicated IP and Server - cron

We have a dedicated server and we are sending emails from a dedicated IP. We are using PHP mailer Script and Exim to send out emails. The problem I am facing is we are sending very low volume emails eg. only 25 k emails but When we check emails in queue, its says 85k emails. We are running cron to fetch and send emails.
The sending speed is very low. It took whole day to send 24k emails and server timed out many a times in Between( ALso smtp 421 error). I am confused if I am only sending 24k emails how come 85 k emails get in queue and why it is taking so much time. I also Talked to support guys but I did not get any satisfactory answer. This issue is related to the script, cron or settings related to server?
Any help will be appreciated.
Thanks,
Anand

If your mails are 25k, but going to multiple recipients at different domains, they will need to be sent separately to each domain, so if you have at least four recipient mail servers for the message, you can easily have a queue of 85k. 4 * 25k > 85k
An SMTP response beginning with 4 (e.g. 421) means the message could not be sent immediately, so try again later. This could just mean there was a temporary problem with the recipient server, or there may be some other reason. You will need to contact the recipient about that one.
As for the speed, based on the volume of messages you are sending, you probably look very much like a spammer. When you are suspected of sending spam, a recipient mail server (or your ISP) can quite reasonably throttle or refuse your connection, causing mails to take longer to send. This is probably why you are getting a backlog.
If you aren't a spammer, hang in there. Eventually, other mail servers will learn to trust you. A new mail server is always going to look suspicious, especially if it is sending a large number of small emails. You will eventually build up a good reputation if you continuously send legitimate emails.
On the other hand, if you are a spammer, give up now, you're not going to win.
If you need to send out lots of messages and cannot afford to wait to build up your reputation, perhaps consider either sending via your ISP's mail server (fair use limits may apply), or using a bulk-mail service such as Mailchimp, or one of its competitors.

Related

can I send an email through a PHP mailer with my localhost without Gmail?

can I send an email through a PHP mailer with my localhost without using Gmail? or any other email service like Hotmail, outlook using my localhost?
Yes, and this is actually the best way to send using PHPMailer. There are two things you need:
A hosting provider that permits outbound SMTP. A large number of providers block SMTP by default, but you may find that they will remove the block on request (scaleway.com), provide an alternative service (AWS), which may also be acceptable.
A locally installed mail server. If you're on Linux, something like postfix is a good choice.
The way it then works is this:
Write your PHPMailer script as normal, but delivering to localhost over SMTP (not via mail())
Configure your mail server to act as a "full" mail server, where it attempts to deliver messages directly, or to act as a "smarthost" to relay through some other service, such as gmail or mailgun.
The main advantages of this approach are:
Perceived performance: your message submissions will appear to be instant, so it's great for things like contact forms
Reliability: if your message can't be delivered immediately, the local mail server will automatically take care of queuing and redelivery attempts, in a way that is far more efficient than you would ever achieve if you handled that within your own application.
As with many things, with great power comes great responsibility, and you will have to deal with bounce handling, blacklisting, inbound filtering (or just block it), etc. It's probably not worth doing all this for a simple contact form, but if you have an application that generates a reasonable amount of email traffic (signups, password resets, notifications, etc), it's a great way to go.

deferred mail plesk, mail can't send mail out of server

My problem is about sending email out of the circle mail server, exemple:
From: name#mydomainename.com
To: name#gmail.com or any other domaine name
The message appeare on plesk under Mail Queue
Messages in queue: 47 deferred, 0 held, 0 incoming, 0 active, 0 corrupted, 47 total.
I was trying many times to re-sending all deferred emails in the queue by taping en console:
postsuper -r ALL
but the same problem all the time.
Now, when I send mail, exemple:
From: name#mydomainename.com
To: name1#mydomainename.com
it works correctly
Before going into configuration changes, have you checked if your domain is blacklisted or not? Were you able to receive E-mails from other domains such as Gmail?
Sending/receiving Emails to/from the same domain is nearly always possible. No matter how messed up the configurations are you will still manage to deliver emails within the domain itself.
Usually I've found that the reason behind this problem is the blacklisted IPs. Make sure that your domain IP is not blacklisted.
https://mxtoolbox.com/blacklists.aspx

Nodejs Email Sending using sendgrid web api

I am developing an email sending service, probably for sending bulk emails using sendgrid web API, but I am not able to figure out best practice for scalable system. I wish to keep a record of all those emails which failed to deliver and retry sending to those failed emails after all emails have been sent. I am using NodeJs, so just wanted to know if there is any way to speed up my process(something like sending multiple emails at the same time)
There are multiple ways to handle this, I will suggest two which seems obvious to me.
(Recommended - Easy) Use Async module's control flow option called queue Async Documentation. You can feed in all the request in form of an array of object request and then change concurrency setting to let's say 100, it'll run concurrent 100 workers at one time and to log errors make a separate mechanism and once all the values have been run through handle it separately.
Spawn multiple workers using node.js native approach.
Sendgrid offers an npm package for node.js integration, so you don't have to reinvent the wheel. It accepts messages at a high rate, so you shouldn't have problems delivering yours to sendgrid. You just dump your messages into sendgrid.
Email, being a store-and-forward system, is inherently asynchronous. That means it operates far from real time. Some messages are delivered in a few seconds, and others take hours (when they get soft--"retry later"--rejections from destination servers, for example).
Sendgrid handles this issue with a "bounces" API. (And with "bounces" features in their web back end application). Many bounces are "hard" bounces, meaning you must avoid trying to send messages to that address again. You can use the bounces API to retrieve a list of bounced messages. You should remove those addresses from your email list, and not try to send them again. (Sendgrid bans users who repeatedly send mailings with a high undeliverable rate.)
They also have an "invalid emails" API. This works like "bounces" and returns lists of addresses that are ill-formed or, if sendgrid can tell, not present on the destination server. Again, you should remove these addresses from your email list. If they're invalid now, they will be invalid tomorrow.
Sendgrid offers all sorts of tutorials on this subject.

Accessing GMail with GMail client and JavaMail (via pop3)

I've written a JavaMail client to access a GMail account via POP3.
As expected, I can only read a message once. When I re-run the client, the message is not found as it has been deleted from the server.
However, when I then log onto the GMail account (IMAP enabled) via a browser, the message appears.
Why does this happen? Are separate copies of the email created for POP3 and IMAP?
POP3 clients access the inbox, and what they see is unseen mail. When the POP3 client has seen a message it's no longer unseen and the POP3 server is supposed to do something.
The gmail server probably moves the message to the Archived folder.
You may have won a prize as the last person to have written a POP3 client, BTW.
Gmail has specific special handling for POP3 account:
In the default mode, it expects a 'download and delete' client. It will only expose 300 or so messages until those are DELEted. They are not actually deleted, but they are removed from the pool of messages to be sent through POP3. This prevents some of the inefficiencies with traditional POP3 clients accessing huge mailboxes, but does allow the client to eventually access everything.
The other mode is recent mode. You can use this mode by putting "recent:" in front of your login, like "recent:bob#gmail.com". This switches it to a mode where it will only show your client the most recent 30 days worth of messages. The messages do not disappear, until they fall out of the window. Again, this limits the size of the message list to a reasonable number for efficiency reasons, but in a different way. However, deletes can be synced between clients. (This may mean archiving in the Google Way). Recent mode is currently documented here in the troubleshooting section I want to download emails on multiple email clients.
Or, you could just use IMAP. Even without using all the additional features of IMAP, you can do everything you can do with POP3, but will allow many other features as your client evolves.

Email and SMS queuing in NodeJS

I am developing a node.js app. In my app, I need to send blast emails and SMS to users satisfying a particular criteria. I use Gmail SMTP for emails and a third party vendor for SMS. I'm assuming firing the API's for email and sms services in a loop is dangerous. What's the right way do it?
The time spent is obviously proportional to N, being N the size of your set. As much users you have, longer it takes. Keep in mind that requests over the network are not blocking in any case.
Anyway, unless it risks N to be thousands or millions of items, you can do it in a loop and attach a proper callback to handle responses/errors.
Otherwise, you can send an email/sms and schedule the same operation for the next element using nextTick (see nodejs documentation for further details).
This way you'll spread all the activities over several iterations of the event loop.

Resources