J
John Smith
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.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
oNS.Logon("username", "password", false, true);
//or alternatively:
//oNS.Logon(Missing.Value, Missing.Value, true, true);
Outlook.MailItem oMsg =
(Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
oMsg.Subject = "Testing";
oMsg.HTMLBody = "<HTML><HEAD><TITLE>Sample
GIF</TITLE><BODY><P>Test</P></BODY></HTML>";
Outlook.Recipients oRecips = (Outlook.Recipients)oMsg.Recipients;
Outlook.Recipient oRecip =
(Outlook.Recipient)oRecips.Add("(e-mail address removed)");
oRecip.Resolve();
oMsg.Send();
oNS.Logoff();
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.Application oApp = new Outlook.Application();
Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
oNS.Logon("username", "password", false, true);
//or alternatively:
//oNS.Logon(Missing.Value, Missing.Value, true, true);
Outlook.MailItem oMsg =
(Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
oMsg.Subject = "Testing";
oMsg.HTMLBody = "<HTML><HEAD><TITLE>Sample
GIF</TITLE><BODY><P>Test</P></BODY></HTML>";
Outlook.Recipients oRecips = (Outlook.Recipients)oMsg.Recipients;
Outlook.Recipient oRecip =
(Outlook.Recipient)oRecips.Add("(e-mail address removed)");
oRecip.Resolve();
oMsg.Send();
oNS.Logoff();