What needs to be done for an application to be able to issue email addresses, such as user123#mydomain.com?
I'm using Amazon SES to send out emails, do they have a service for this or would this have to do with the domain registrar (GoDaddy), or both?
The client to check email would be the web application itself.
I'm using C#.Net and Mvc for that as far as development is concerned but would prefer to use existing SaaS wherever possible.
What are some good ways to go?
EDIT: I checked with GoDaddy and they can't do this at scale. I don't believe Amazon does this either. How is this done?
This would all depend on your implementation of email server host. If you are running Windows with IIS and Email Post office then users are of the host domain. You can use the admin scripts for adding users from the site in this case.
If you are using Linux and a thrid party email service, it will likely have a user interface for adding users. Howerver these implementations generally use MySQL on the backend so you can add users through script from an implementation of PHP through Apache webserver host or backend service that adds users through MySQL script.
You need a mail server. As you can see from the list there are plenty of mail servers that exist, however there are some serious leaders in the field:
According to one survey, sendmail, Microsoft Exchange Server, Postfix,
and Exim together control over 85% of market share for SMTP service in
2010.1
I strongly recommend not hosting such a server in your code (if an implementation even exists, which I couldn't find)
After configuration of the mail server (which may need some intensive investment either in time or money, since this is complicated; some mail servers are notoriously complicated) you point your domain to the mail server. Mails can now be received to the email adresses you define.
This process is complicated, and I have a feeling that your question shows you don't know exactly what you need either (In fact I would have recommended closing it as too broad). I'd recommend reformulating exactly what you need and what you have so far. Don't hesitate to get in touch with someone that may help you formulate your needs.
Related
I'm trying to understand exactly what it is I need to be implementing and am just after a little guidance. I know very little about email standards such as POP3, IMAP, SMTP which is probably what's making the getting started difficult.
What'd I'd like to do consists of a couple of things:
Be notified of the arrival of an email at a specific custom address. e.g. hi.me#myapp.com.
Handle multiple addresses per user.
Be able to process this email and either delete it, leave it and be able to display in a web email client or forward it on based on various rules.
I've seen a few SMTP libraries and a POP3 one, but I'm not 100% sure what I need to do this. I'm guessing the best way would be to write a full C# mail server - but I'm hoping for a little guidance/suggestion.
Thanks
If you really want to build a mailserver from scratch, the protocol specifications are all available as RFCs.
For IMAP that would be RFC-3501 and for SMTP RFC-2821, you can google for the rest.
I've been working on a C# SMTP server in my (very limited) spare time, mostly out of frustration with existing MTAs and as an exercise in C# server programming. I can tell you that there's a bit more to it than you might think. So if you want fast results, I'd seriously consider hooking into an existing MTA/mailserver setup.
Depending on how fast you want to process messages, it may be sufficient to poll one or more mailboxes. You could process the messages and, for example, forward them to another mailbox using the built-in .NET SmtpClient.
On top of that, all mail servers I know of implement not just the SMTP protocol but also a slew of anti-spam measures. Most of these measures have matured over many years. You get all that for free if you build on top of an existing mail server infrastructure.
Then again, configuration of just about any mail server I know seems to be a fine art, hence my frustration with them.
I want to pass certain parameters to a desktop application remotely via the internet. I don't want my application to contact the server repeatedly, because many such applications can bring the server down easily. Is there a way to initiate the connection from the server? How can I identify the applications, as there will many of them running on many computers somewhere around the globe. I don't know where to start - I'm trying to do this in C# and ASP.NET/PHP on the server-side. Please give some advice.
Is there a way to initiate the connection from the server?
No. Not without having the client contact with the server first, informing it with the IP address, port to use etc... Which the server will need to keep for each client, hoping that they don't change (or get updated when they do change).
Long polling by the client is the right solution for what you are doing, even if you don't want to use it.
There are many different ways you could approach this, just thinking out of the box, both your app and the server could utilize a different mechanism for transferring the settings. I'm not recommending any of these methods, please don't shoot me down, they are all just ideas.
As an example, your server could connect out using FTP and output the updated settings to an FTP server on each PC. You could install something like Filezilla on each machine which runs your app. You'd obviously need to configure port forwarding on the router to allow the server FTP access.
You could use email. Setting up an email account where your server can login to send out the settings. Your app could possibly login to the same email account possibly even a single Gmail account to retrieve the settings.
Another idea would be to use a file sharing service like Dropbox, Google Drive or similar and where the settings could be shared. Obviously this would involve learning any API and I'm not sure if there are any restrictions on this approach.
The last idea and probably my preferred approach would be to host a web service and database on a remote server, both your server and the applications would connect to the same service to transfer the settings. This approach is obviously firewall/router friendly as all the clients connect out to the web service to collect the required data.
Hope this helps?
I have an existing asp.net c# application for which I'd like to implement a feature that allows users to post content via email. A user would send an email to a designated address and the system would parse the email and create database entries using the email subject, body and any attached images. My proposed approach is to create a windows service that pings a pop3/imap enabled email provider to retrieve incoming emails. The service would then parse the emails using an existing library I found here http://www.lesnikowski.com/mail/. The user would be matched according to the email address in the from field to the asp.net membership and then new records would be inserted from the contents of the email for that user. Initially the windows service would run on a separate EC2 instance that I'll set up for this purpose since the current host does not permit root access. But eventually I'll probably migrate the entire site to EC2.
Before I dive in I wanted to get some feedback from you all on my overall approach and architecture. More specifically:
Is what I described above the approach you would take?
Would you recommend implementing a web service to manage the interactions between the windows service and the database of the asp.net site? Or would you recommend hitting the database directly?
If I program the windows service to
ping the email provider every 30
seconds, will that be a problem?
Do you foresee any security issues with this approach I've outlined?
What about issues with reliability (needs to be a 24x7 service)?
Additional Background --- the asp.net website is an inventory system where each entry has a name, description and optional images. From the email the subject will become the name, the body will become the description and the images are the images. If you're familiar with the Posterous blogging platform you'll have an excellent reference point for what I am trying to accomplish.
Is what I described above the approach you would take?
It would be better if you could set up an Exchange server or sth similiar where you get notifications about new emails, so you don't have to ping every 30 minutes, but I never did it this way and cannot tell you if this is even possible.
The approach itself sounds plausible, because sending emails is really easy and everybody knows how to do that.
Would you recommend implementing a web service to manage the interactions
between the windows service and the
database of the asp.net site? Or would
you recommend hitting the database
directly?
I would recommend an extra abstraction layer, because it is not much effort and improves the design. This decreases performance (shouldn't be that much), so it depends on your requirements.
If I program the windows service to ping the email provider every 30
seconds, will that be a problem?
Depends on your email provider. Normally and if they allow it: No. You should definetly ask them first.
If it's your own: You're good to go.
There can be problems however if you're doing this inside a thread and you're accessing the IMAP multiple times at the same time. You should try to avoid that.
Do you foresee any security issues with this approach I've outlined?
Yes. You can easily forge the "from" field of an email you've send. There can be issues then, if the email is known. You should definetly add some kind of extra security like sending the mail to <SaltedHashThatIsDifferentForEachUser>#example.com. (Facebook does this too for example)
What about issues with reliability (needs to be a 24x7 service)?
I see more problems with the reliability of your email provider than with your service, because as long as the emails are saved, you can still parse them later.
You should investigate the maximum size of your imap to avoid rejected mails (e.g. delete them once you've successfully parsed them)
Would you recommend implementing a web service to manage the interactions between the windows service and the database of the asp.net site? Or would you recommend hitting the database directly?
There is no need to have a web service, it will just add complexity as well as introduce another attack target on your web server. Having your windows service hit your database directly will be simpler and more secure.
If I program the windows service to ping the email provider every 30 seconds, will that be a problem?
Should not be a problem ... Email providers provide POP3 and IMAP so that external services can use them (outlook, thunderbird, iphone) so they expect them to be constantly pinged.
Do you foresee any security issues with this approach I've outlined?
As Simon stated, emails can be easily forged, providing a security vulnerability. This link discusses a hacking incident on posterous and the trade off between ease of use and security. As a CISSP, I tend to lean toward security, especially when the vulnerability very easy to exploit.
The unique, "secret" email address is a better solution in terms of security. However, it takes a lot away from your goal of simplifying the update process. It also makes your solution more complex and costly since you will need to be able to support (and programmatically create) an unique address for every user.
What about issues with reliability (needs to be a 24x7 service)?
Most mainstream email providers have outstanding availability. In regards to the availability of this solution (without the preexisting factors such as your current hardware and hosting facility), you would want to ensure the windows service was well written and included some "fault tolerance". For example, the services i have written in the past handle a few select errors caused by external dependencies (database or email being unavailable) so that it does not crash but just waits until its back online. This provides better availability since the service is ready to go when the dependency is ok again, without someone required to manually restart the windows service.
Is what I described above the approach you would take?
Due to the security vulnerability exposed by relying on the sender of the email for authentication and authorization, I would not take this approach. If the main goal was to simplify and streamline the addition of new items from mobile platforms, I would probably create a "mobile friendly" web page to accomplish this.
I just returned from a web design conference in Seattle and it was heavily focused on "non-pc" platforms. After listing their very innovative ideas and best practices for designing for the mobile industry, I can see a web app being a great solution to achieving this goal.
Our e-commerce site requires the sending of email
Currently, for some odd reason, the server that is being used to do this is the database server... which clearly isn't ideal (i've just taken over here)
My idea is this -
to write a windows service that checks for new mails that need sending (these are all in a sql db) and then process the mails seperately...
I want to use a seperate mail server, to keep this efficient..
Has anyone had any experience of this?
Would it be sensible to (for example) set up a lightweight debian (or other distro) machine, with exim on?
Would i be able to use that as the host ip address when specifying my smtp server to send email?
I'm going to be using C#....
I've done this quite a bit, and sometimes I've used a windows server running the SMTP service, other times we've used a third party. In either case you set the host of the mail server in the configuration file and your application can pick it up and continue working.
A nice thing about using a third party service, is that you should have less concern about being black listed.
We did something very similar. We used the IIS SMTP server and wrote code in C# to pump messages directly into its pickup directory using SmtpDeliveryMethod.PickupDirectoryFromIis. systemnetmail.com has some sample code that may help you.
One thing to be careful of is race conditions in the database, especially if you are sending messages with more than one thread (which we were doing). We implemented a queue in the database and used the UPDLOCK and READPAST hints in SQL Server for maximum performance. I think we got it up to over 10,000 emails a minute this way.
You can use the Windows SMTP server wich you can access and use from your web or console application using the CDOSYS or CDO object. You can use this link about configuring the SMTP server on Windows 2003
Is it possible to find POP3 server address for any given email id (like sam#mycustomdomain.com)? If yes, please provide some guidance preferably in PHP or .Net.
Edit :
I get addresses by querying MX record but those are not always the same which people use to fetch their emails.
I don't think you can "guess" the POP3 server for any email address and be right each time, no : the POP3 server can either :
be something like pop.thedomainnameintheaddress
or something totally different, like ssl.hostingcompany.com
In the first case, you could try to guess -- and sometimes be right... But in the second, you don't stand quite a chance.
You might want to take a look at Thunderbird 3 : I think it includes some auto-configuration mecanism about that : you enter your e-mail address, and it tries to find the POP server for your.
Not sure how it works, but I suppose there is a database containning that kind of informations, that Thunderbird sends requests to ; that would be the "best" solution, I'd say, as it can be updated without having to change Thunderbird itself, and doesn't rely on "guessing".
About Thundrbird's autoconfiguration mecanism, here's an interesting link : https://wiki.mozilla.org/Thunderbird:Autoconfiguration#Implementation -- especially the third point, which links to a directory where you can find configuration files for lots of domains.
For instance : https://live.mozillamessaging.com/autoconfig/gmail.com
Gets you an XML file indicating how Thunderbird has to be configured for #gmail.com emails.
And there's quite a couple of configuration files for other domains -- so this might be an interesting idea, at least for "well-known" domains ;-)
Of course, this doesn't solve the problem for non-well-known domains...
I don't think so; at least, not in a general way. Emails are just forwarded on to the right domain, and handled internally. For instance, my email address is stored on a server that provides both IMAP and POP access, and also forwarded to a webmail provider, who provide IMAP and POP access. So the question 'what's its POP3 server?' doesn't really make sense.
No, not really. It is however possible to find an smtp server for an email address. It is really not specific to any programming language, but the way you would go about it would be extract domain from email address (eg. me#somedomain.com => somedomain.com) and then make a dns query with type=MX. This will return the servers that accept mails for that domain, in order of priority.
If the question is, "For any given email address is there an automatic way to find the address of a POP3 server for it?" I'd say the answer is no.
Some people perhaps don't have POP3 access to their emails at all, and many people such as myself have our own domain hosted at a service provider and the POP3/IMAP servers are under the service provider's domains.