Make GoDaddy to send your mail
Remember those lazy days when you could kick your trustworthy CDONTS mail messages from anywhere inside juicy spaghetti code and it just worked? Well, those days are over. Even 1.x’s System.Web.Mail – also not a brainier to use – is outdated and big no-no our days.
Now we supposed to use [W:SMTP]. And sometimes this beast just refuses to cooperate. Complete showstopper. I’m not a quitter, but I’m not going to spend countless hours googling around for the fix either (although, I admit, it is kind of addictive). So after short hunt, when first four or five “guaranteed” solutions did not work out I started looking for workaround.
Because I’m using GoDaddy, first I looked what they have to offer. Found another SMTP “solution” – nope, did not work either. Then there is a strange animal called “Form Mailer” – forums insisted that it is “classic” ASP only and does not work with ASP.NET. Fine. Or does it? I gave it a try. One of those days, I guess – everything is upside down. It worked. So, if you are in the same hole I’ve been for a while, there is how you can make GoDaddy send your emails (yes, even if your account .NET 2.0 only).
- Go to GoDaddy’s hosting account / control panel / content / form mail. Fill in email address you want “daddy” send your messages to and “enable” form mailer. It is simple wizard; all you need is to click “ok” couple times.
- GoDaddy will generate gdform.asp and put it in the root of your hosting account. The whole purpose of this .asp page is to parse form that invoked it and write data to the file. This file then will be picked up by scheduled job that will actually create and send email to address that you’ve set up in the step one.
- There are defined field names (or query string parameters) that you have to use. Sure, you can also change .asp script itself to use other names if you already have contact form in your application that you want to use, all you need is to submit form to gdform.asp. So, simple HTML form shown below will work just fine:
That’s it. You don’t have to set SSL, make sure your host port is not blocked by firewall, no configuring POP accounts, sending passwords back and force, adding stuff to your web.config and thousand other neat details that make SMTP look like can of worms. Ok, it may be a bit of a hack and security is somewhat questionable, may be. But till all that SMTP mess is fixed or dumbed down to my level – I’m going to use this one! Oh, and you don’t really have to use HTML page at all – you can even “send” mail this way from your business class, using ASP.NET request object. Although that will be a little bit more involving.