Hi,
I'm trying to send email in our C# ASP.Net application using the Outlook 11
library. For a bunch of unimportant reasons (unimportant to this posting
that is) we have to do it this way and can't use SMTP.
When I run the application through Visual Studio.Net (by clicking debug in
either debug or release modes), it works fine and the email is sent. When I
run it by going to Internet Explorer directly and typing in my local host
address, the application just hangs and waits when it trys to send the
email. I do hear my machine make that alert noise as if a warning pop up
just opened, but none are there.
Is it not possible to do this? If it is, what do I have to do to so it
doesn't hang when run directly?
If you're curious, here's the code:
Outlook.Applica tion oApp = new Outlook.Applica tion();
Outlook.NameSpa ce oNS = oApp.GetNamespa ce("mapi");
oNS.Logon("user name", "password", false, true);
//or alternatively:
//oNS.Logon(Missi ng.Value, Missing.Value, true, true);
Outlook.MailIte m oMsg =
(Outlook.MailIt em)oApp.CreateI tem(Outlook.OlI temType.olMailI tem);
oMsg.Subject = "Testing";
oMsg.HTMLBody = "<HTML><HEAD><T ITLE>Sample
GIF</TITLE><BODY><P> Test</P></BODY></HTML>";
Outlook.Recipie nts oRecips = (Outlook.Recipi ents)oMsg.Recip ients;
Outlook.Recipie nt oRecip =
(Outlook.Recipi ent)oRecips.Add ("us*******@our domain.com");
oRecip.Resolve( );
oMsg.Send();
oNS.Logoff();