Test Drupal Messaging and Notifications without sending messages - drupal

I'm upgrading a drupal website. There are thousands of users and it is using messaging and notifications. By accident I have sent out loads of notifications to users. Is there any way I can prevent the emails going out to users and still carry out my upgrades? I don't want to disable the modules as I need them enabled to do the upgrades.
Any help appreciated

If you mean to temporarily disable/reroute mails on a test/staging instance of your site, take a look at the various options provided in this post.
If you are talking about a live site, be careful - those methods mostly apply to all mails send by Drupal, so you would also disable other mails like e.g. a 'reset password' request.

Usually in Drupal, mail is sent out instantaneously to the mailserver. In some situations, people setup queues in Drupal to send mail. These mails are then sent out from the queue (maybe 50 to 100 at a time for example) when the cron.php runs.
Are you using any of these modules (or similar ones)?
http://drupal.org/project/queue_mail
http://drupal.org/project/mailq
If you are, then you might be able to "empty" the queue for any pending emails.
In general, you can make sure that mails are not sent by blocking the smtp port (usually port 25) on your computer while you are doing an upgrade. You can easily block the port by making a temporary firewall rule.
There might be also be a queue on your mailserver. So you might be able to go to the webserver and delete any pending emails that have not been sent out yet.

Related

ASP.NET SMTP Failover solutions

My knowledge and experience of this is limited, so not sure if I've considered everything and would appreciate some advice.
Current scenario: one Exchange server, one database server, multiple load balanced webservers, all sending confirmation and alert emails on a regular basis. This exchange server is used extensively across the business which is causing a high load which the exchange server can't handle. At one point the server went down for an extended length of time, leading to emails not reaching their destination and with no logging of email attempts to determine what emails failed, so that they can be manually sent at a later date. Additionally, the website waits for the SMTP response so there's a delay in the web page loading.
Plan: A second SMTP server is to be introduced to reduce the load on the original server, along with implementing some improvements to the website to reduce it's resource hogging and improve logging of all email attempts (just header info), with SMTP response status.
Possible Solutions:
Change the website's email method to log, then attempt SMTP via one or other server, record the smtp response. Pros: Quicker to develop, Cons: No asynchronous processing of email queue.
Log email headers, then use MSMQ or RabbitMQ to send email request to a queue, and have a listener service that handles the process of actually sending the email to the Exchange server. Additionally if it continues to fail to reach the SMTP servers, leave it in the queue and retry again at a later time. Pros: Can re-use the infrastructure and experience to use MQ in future feature requirements like user requests to download data, a la Facebook. Cons: Time to learn how to do it, and actually develop when faced with a deadline.
Log email to db, then send to a local pickup folder which relays to the Exchange server, but I think this has no failover support, or method for updating the status in the email log, so while it seems quick to set up, doesn't really meet all of the requirements as far as I can see.
What I'm tempted to do is do is develop in two phases, initially just the first solution then develop the MSMQ/RabbitMQ functionality to make it asynchronous at a later date, but thought I'd ask for opinions to see if I'm overlooking something.
You may want to have a look at NServiceBus.
Specifically, there's some very new email functionality. A satellite has been created that gives you the benefits of the retries that come with NServiceBus to make your email sending more robust.
You get a separate queue without requiring a new endpoint or configuring any message mappings. This way every endpoint has this capability built in and the only config needed is a SmtpClient config section.
The API for this feature is Bus.SendEmail(new MailMessage). They’re using the System.Net.Mail.MailMessage as the abstraction for sending emails.
The code is currently in their develop branch. A sample demonstrating all this can be found here.
For more details see here

E-mail sending using Gmail

I've developed an email application which can be consist of several attachment.size of those attachments could be 20MB or even higher and i'm using smtp.gmail.com as my host.my issue is it's very slow.i think it may because attachments are uploaded when the Send() mail function is called.is there any option to solve this issue?
The bottleneck is your Internet connection upload speed.
The only way to resolve this issue is to lease a faster Internet connection.
On most broadband connections, you should expect this upload to take at least 100 seconds (200k per second upload).
Web Email Clients (Like Gmail) get around this with asynchronous uploaders. The attachment begins uploading as soon as you select it (even while you are still typing out the rest of your email, before you hit send). Unfortunately, I do not believe there is an API that allows async file upload to GMail for this purpose.
With that said, you may be able to do an async upload to another server, and simply link to that file in the emails that you are sending.

How to send 1000+ emails per day using an ASP.NET Web site

We have a website that requires to send 1000+ emails a day to all the customers who opted for the alerts. In couple of months time we are expecting to raise our customer base to 5,000 and so we may need to send 5000+ mails every day.
At the moment we are using GoDaddy email server(the email services associated with our domain) and it permits us to send only 250 mails a day. Which is far less than what we need.
Is there any cloud based service that allows us to send as many mails as we want? or do we have to install an email server on our dedicated hosting server?
Please suggest me the possible solutions to this problem as well as the software/services that are required.
Updated:We have Windows Services that run in the background to generate the required emails and send them using SmtpClient class. Our problem is restrictions imposed by GoDaddy(only 250 emails per day)
If you can't or don't want to install your own mail server, then one option is to lookup the MX records for the destination mail servers, and do the delivery directly from your application using the SmtpClient class.
Ideally, you should do this from a background thread (a Windows Service would be even better), to minimize interference with the rest of your web site.
IIRC, MX DNS lookups aren't available as a standard Framework call. However, they are pretty easy to add using p/invoke.
There are a number of different solutions out there. If you want to send all the emails you want you will need to get a good reputation with all the Email Providers like Hotmail, Yahoo Mail, GMail. This can be quite difficult since they do everything according to IPs and getting a fixed IP in a cloud can be difficult.
You can use providers, like smartFOCUS DIGITAL, to send the emails for you and they take care of the reputation with the ESPs.
I suggest you to use your own mail server. Some email servers set to check sender mail server is authorized to send email. I mean sender email server must be authorised to send your domain's emails. Otherwise receipent email server drops emails.
While this question is a bit dated. I have recently undergone a search for a host, and stumbled onto JodoHost.com. They have a reseller program in which you can have a domain classified as a 'mass mailer'. You have to sign a waiver stating that you won't use it for spam, but they give you 'unlimited' emails.
You will want to verify with them that 5000+ emails won't be an issue.
Now outside of finding a host that will allow you to send this many emails (as many ISP's will prevent this number as well), you have two options.
Invest in a dedicated server. This way you can host as many sites as you'd like on your server and send as many emails as you want. MailEnable is a perfectly suitable application to use, though its free version is limited to one domain. With this option, your cost will rise significantly over cheap GoDaddy hosting.
Use a third party service to send your mass mails. A prior employer had a list of 40,000+ users and we used a third party service to manage our list. That way they are responsible for a lot of the details to managing a list that size (add,remove, spam complaints, etc..)
Easy solution is not to use a website to send all these emails just use a desktop application.
No dedicated server in a cloud is needed, an smtp server installed will do.
Well that and a bulk email component like: aspnetmail

Sending mass email campaign via ASP.NET

I have read a few other posts on here about mass emailing, but I need some other information. We want to integrate our mass e-mail system into our current application, but I fear this may not be a good idea. Does anyone have any input as to what kind of resources are needed to send, potentially, 1000's of emails an hour? We only have one web server right now and do not have access to our mail server. We do have full access to our web server, however. Would it be a bad idea to host the mass e-mail application on our current server? Should we have a separate sever to run this type of application and call the server via web services (WCF)? Each email would need to be sent separately because the links on the e-mail are for tracking and unsubscribing purposes. I appreciate your thoughts.
Daniel
Yes its a bad idea,
One of the key things for detecting spam, is the IP address it came from (Known as its reputation) if you start sending out alot of emails which end up getting marked as spam (Which is likly, even if the users said they wated to recieve email) your IP address could end up in trouble. I wouldnt fancy doing this on my webserver.
As for specs, your bandwidth is going to be hit hard when you start doing somthing like this. Although I think you would be suprised at how fast you can send out emails (Mail Server Dependant)
Either way when it comes to sending mass mail campaigns out, I'd speak to a third party if its somthing you are serious about, they have the knowledge and hardware to perform campaigns that are not going to damage your IP rep.
I think this issue all depends on your mail server. I've been in a project where we sent out 50-100K emails in a few hours and the main limitation was the capacity of the mail server. In my opinion it would be fine to have the mail client run on the web server as it won't be using too much resources if well written, the main question is what the mail server can take.
You can help your reputation on some email providers by contacting them and or filling out bulk mail registrations.
This is for yahoo:
http://help.yahoo.com/l/us/yahoo/mail/postmaster/bulkv2.html
I would not recommend using exchange for anything like this. You will want a separate bulk mail server like Ironport.
http://www.ironport.com/
Otherwise your internal emails will get stuck in the queue with all of your bulk emails which you definitely don't want.
The actual code involved does not have to be that complex. In my case we used an asynchronous task to loop over an email list table in the DB pulling out a batch of 20 or so at a time sending then sleeping for a number of seconds. Email providers do not like receiving hundreds/thousands of emails from a source at one time. Even better if you can stagger the list by providers.

Is there any mail queue system in ASP.NET?

Is there any mail queue concept in ASP.NET?
I want to send thousands of different mail to thousands of users (i.e. each user will have a different mail). I want to send the mail at a particular time, so each user receives it at a constant time.
There really is not mail queue in the Core framework. You can send individual messages synchronously or asynchronously, but you can't really send a bunch at once.
You can queue your messages by storing them to a database or file server and then kicking off a job to loop through your saved messages and send them off.
Also, not all of your users will receive the messages at the same time, even if you could send them at the same time. There are too many external variables and dependencies (network traffic, mail server loads, spam filters) to accurately predicate when or even if your users receive their messages.
There's no native MailQueue concept within .NET framework. The queue will have to be implemented yourself. In your case, you would like the mails for each recipients to be sent at about the same time for all batches. Am I right?
Well, this is a bit tricky. You can use any SMTP server, localhost or external ones. But that also mean although you can dispatch to the SMTP server at a specific time, there's no guarantee it will reach the recipients immediately.
There are a whole bunch of stuff on mail delivery which are not exactly programming related (grey listing, spam filtering etc etc).
The alternative is to have full control on the sending and have your app directly sending the mails to the recipients' mail servers. Well that is workable and I suggest you use a commercial or a good open source component for that. Anyhow, there's still a whole bunch of issues you need to deal with, (e.g. some receiving mail server like Yahoo might block the sending a few times and let it through after a few retries).
I've posted a related question, take a look at the replies here.

Resources