Improving WebMail performance MVC3 - asp.net-mvc-3

I'm using the MVC helper WebMail to send emails. However the speed of it seems to be of concern. Especially when I have to send more than 1 email at the same time. I tried using a thread, but that didn't work since the Webmail object was null. How do I speed this up? Any ideas appreciated.
Forgot to mention, this is during testing and I'm using localhost and gmail! Not sure if that is causing the issue.
Thank you

If you want performance, don't use the WebMail helper. Use the classes in the System.Net namespace.
This allows you to open a new thread and send the email out-of-band from the web request.
We use Google Apps mail (gmail) in the cloud, opening a new thread, and sending the email from there, using the System.Net types (not WebMail). It works pretty well, as we can respond to the user without having to wait for the email to be sent.
Be careful about using Google Apps / gmail though, especially in development. We had one of our accounts disabled by google because of this. During development, you should use your local ISP, or better yet, use SpecifiedPickupDirectory, as it works better when unit testing email receipt.

Related

How to force the gmail inbox to reload/refresh?

I have built an application that uses the import endpoint in the Gmail API Gmail.Users.Messages.import() to clone an email message but allow for subject changing.
It then deletes the original/old message using the remove endpoint Gmail.Users.Messages.remove()
I would like a way to refresh the Gmail inbox UI or even to just reload the web page from Google Apps Script - however, I'm not aware of how to do this - and a look around the internet hasn't proven especially helpful.
Unfortunately it's not possible to control the user's Gmail interface via an API (or add-on). The best your application could do is instruct the user to do it themselves.

Sendgrid Xamarin Forms

I'm using the free Sendgrid Account on Azure and I'm building a Xamarin Forms App and was wondering about the best way to send emails seeing as I can't use the Sendgrid SDK. Is it possible to send the email by manually forming the HTTP request headers? I've no code on this and I'm completely at a loss!
Cheers!
In my opinion it is bad practice to send mails directly from your app altogether. It means that you rely on your users network etc. if ports are open and even more; you expose your settings of your Sendgrid account in an app that can potentially be reverse engineered and taken out of your binary.
You should move the code to send an email to your server-side and only send a signal from your app that an email is to be sent at that time. In your server code you probably can use all the Sendgrid SDK code without a problem.

Slack: Get notification when Bot is offline

I searched the www for a solution to a problem of mine without finding an answer.
I need to get notificated when my bot in slack goes offline, but I don't know how.
To get notificated when he logs in is cacke, because I can set him to send a message, but when he's off there is no option to send a message.
I prefer PHP, Javascript, but other languages are also fine.
Thank you very much for your effort
There are many options how to setup a way to monitor your bot and get notified when it is offline.
One option that has worked well for me is to use an external website to monitor your bot. That website will send requests to your bot every couple of minutes to see if is is still alive and will notify you if the request fails. You may need to extend your bot a bit, so that he can reply to these requests in a proper way.
There are many website that provide this service. The one I use is uptimerobot, which also happens to be free for up to 50 monitors.

How can I access Gmail's native API?

I would like to access Gmail's native API. Eg,
create a search folder
tag messages
other gmail-specific actions.
There's this similar question, however the question asker seems happy with developing contextual gadgets rather than actually accessing a user's email.
In before anyone mentions: IMAP and POP are generic, non search based protocols and do not provide full access to gmail. Neither gmail.com, nor any of the official Gmail native apps, use IMAP and POP.
Most webmail services have private, non-IMAP/POP APIs and protocols, eg, hotmail (back when it existed used HTTPMail which was reverse engineered and implemented by hotwayd).
I could run Android gmail with a proxy and attempt to reverse engineer the Gmail protocol itself, but I suspect others have had the same need in the past and may already have a solution.
I did find a list of client of Gmail clients on Gmail Agent API but they don't seem maintained past 2004.
Android's Gmail app is using Google Cloud Messaging (GCM) to push email messages/notifications and sync with the phone. I think that’s “the API” you are looking for. The bad news is that it is obviously very well protected.
You can get started for free with GCM's JSON REST API and use it for your push messaging projects, but forget about using it for your Gmail in the same fashion Google does. The only option for getting a similar efficiency would be using IMAP's IDLE extension, which uses also push.
Focusing on what you need, I think there are decent solutions for the use cases you have listed in your question… You could use a [**Google App Script**][4] or libs like [**GMail for Python**][5], which seems a valid option to me... from the [**GMail for Python GitHub**][6]:
Features
Search emails
Read emails
Emails: label, archive, delete, mark as read/unread/spam, star
Manage labels
If you are developing an Android mobile app Gmail Public Labels API could also be of your interest...
Hope it helps...
EDIT: Google just introduced its GMAIL API
Update June 2014: Google have announced access to the native gmail API.
The Gmail API gives you flexible, RESTful access to the user's inbox,
with a natural interface to Threads, Messages, Labels, Drafts, and
History. From the modern language of your choice, your app can use the
API to add Gmail features like:
Read messages from Gmail
Send email messages
Modify the labels applied to messages and threads
Search for specific messages and threads
https://developers.google.com/gmail/api/

What's with web applications sending notifications via delaying loads?

I've noticed on a lot of applications recently, such as Google Docs and Facebook, that JavaScript is being used to load a file which doesn't load until the website needs to send you a notification.
Essentially, they're using an HTTP request to a file, and then the server which handles the file doesn't respond to the request (or may respond but not send the content) until the server wants to send a notification (such as a new IM or a document update) to the user.
I haven't been able to find much on the web about the best practices for doing this. It seems to be a relatively new technique.
I'm looking into doing this myself and would like to read more on it. Does this have a name? Are there established best practices for doing this?
You could start reading about Comet technology. And here is a good Comet Server, APE: Ajax Push Engine

Resources