The other day, my wife decided to make a joke on me and used the contact page on this blog to ask funny questions. Yesterday, she was asking about my blog, how it was going, are people interested, do I receive... emails? hmmm, why is she asking all these questions suddenly? Finally the cat went out the bag... She told me about her joke... but I never received any email. Alright, this could be due to a SMTP configuration problem. But BlogEngine.Net "test" email function worked (this is part of the admin page to test SMTP values)... I then tried the contact form myself and I never received any feedback... I tried again by filling the "from" field using a different email and this time it worked... hmm, okay, the difference between my wife (as with my first test) and my second test is hotmail.com. I can even use the contact form using a fake "from" as bla@blablabla.bla and it will work.
This site is hosted on GoDaddy, my lfdx.com emails are hosted on GMail. It's known that to use GMail POP3 you need to use the port 465. But this port is blocked on GoDaddy servers. The solution is to set the SMTP server to relay-hosting.secureserver.net (GoDaddy server, considering that you already have set your MX records to point to googlemail.com). So, where is hotmail.com blocked? Somewhere within GoDaddy infrastructure I suppose. This is not crucial and I don't have time to investigate with GoDaddy.... Let hack the code then. Quicker and funnier!
Since I have compiled BlogEngine myself, it was easy to "debug" and "patch" the code... I opened contact.aspx.cs page and went to SenEmail() method. That's where I decided to hack the "from" field. Here is how... nothing complex.
I replaced this:
mail.From = new MailAddress(txtEmail.Text, txtName.Text);
to:
string email = txtEmail.Text.ToUpperInvariant();//for the String.Replace method
//Hotmail patch for GoDaddy-Hotmail-GMail issue
if (email.EndsWith("HOTMAIL.COM" ))
email = email.Replace("HOTMAIL.COM", "_REMOVE_hotmail.com");
mail.From = new MailAddress(email, txtName.Text);
This way, I receive hotmail emails and if I need to do a reply, I just have to delete the _REMOVE_ part.
Unfortunately, I don't like the way I hacked BlogEngine.Net code since the next time I will upgrade BlogEngine.Net, this part will be overwritten. But I don't have time to figure a best way for now.... If anyone has one, you are welcome to share your solution!