Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send mail using Outlook

Status
Not open for further replies.

cathiec

Programmer
Oct 21, 2003
139
0
0
IE
Hello,

I want to send an email via Outlook 2003 (SP1) from an asp.net page. I have
tried using the SMTP classes as recommended by Microsoft, but the environment
of my client, the email messages never arrive when sent using this method;
hense using MS Otlook on the wenserver. The code is below:

Dim oApp As Microsoft.Office.Interop.Outlook.Application
oApp = New Microsoft.Office.Interop.Outlook.Application
' Create a new MailItem.
Dim oMsg As Microsoft.Office.Interop.Outlook.MailItem
oMsg =
CType(oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem), Microsoft.Office.Interop.Outlook.MailItem)
oMsg.Subject = "Hello!!!"
oMsg.Body = "Hello World"
oMsg.To = "me@gmail.com"
oMsg.Send()



The code runs fine in the Visual Studio 2005 development web server, but a
security error is thrown on publishing to iis 6 (on windows server sp1):
Retrieving the COM class factory for component with CLSID
{0006F03A-0000-0000-C000-000000000046} failed with HRESULT: 0x80070005(Access
is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))).
Can anyone advise?
 
If you want to launch outlook on the server, you'll need to go to the Component Services and add launch/execute rights for the ASPNET (or Network Service if it is a win 2003 box) in the DCOM section.

I'm not sure why your first method failed (maybe you don't have an SMTP Server installed?) but I wouldn't recommend using outlook to send your emails from an ASP.NET application.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Certain firewall and anti-virus products can block SMTP sending from "client" machines. If you are running in a corporate IT environment you might ask them for advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top