So…. Sometimes the very simplest of
things can take gargantuan efforts to work out and you find out that the
detail really is just too much detail.
Just such a situation happened
with me this week when working on a site I am developing. I needed to
implement the sending of an email once a post had been received from an
MVC page to indicate that a booking had been made. The mail would be
sent both to the establishment where the booking was made as well as a
copy being sent to the person making the booking. I elected to use the
inbuilt System.Net.Mail class,
how hard can it be right?…… Well A damn sight harder than I thought
that’s for sure! This week there will be no code sample as code was in
this instance not at fault or has no bearing on what was happening. To
cut a very long and very boring story short it did not matter what I did
I could not get the mail class to send the mail; upon sending, the
operation would timeout or the server would disconnect etc etc. It made
no sense so I took a step back. I had been utilising my Yahoo account
using the smtp.mail.yahoo.com
server and of course as this was secure and requires authentication I
used port 465.
So I thought maybe the issue is with Yahoo and I changed
to my Google account instead using the smtp.googlemail.com SMTP server again with port 465. Still no dice…..Odd. Much headbanging later and I stumbled across this StackOverflow article which led me on to this blog.
Now I’m not going to lie and say that it all makes sense to me. It has
at least allowed me to at least find a workaround by in this instance
using port 587 on my Google SMTP server. If I sat down and thought about
it I’m sure I could understand in finite detail what exactly Explicit
SSL is and why the .NET mail client only supports this type of SSL, the
point is…. I just don’t want to! I feel like I’ve already wasted enough
time dealing with this bug (I’m sorry, Its not a feature its a bug
whatever they say and one they seem reticent to fix).
Normally I’m a man
who likes to get the detail, a superficial overview is never normally
enough as it leads to design mistakes. However in this instance I now
know in enough detail for me that the .NET mail class does not support
all SSL SMTP conversations and I’ll continue to bask in my own
ignorance.
Written by Conrad Rowlands, Team Leader and Developer, DSCallards
No comments:
Post a Comment