PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook Interoperability Programmatically Send Email from Service

Reply

Programmatically Send Email from Service

 
Thread Tools Rate Thread
Old 11-07-2003, 06:47 PM   #1
Brian Reed
Guest
 
Posts: n/a
Default Programmatically Send Email from Service


I have a service that is running on my machine that is configured as a
specific user. I am trying to having problems sending email from this
service. I am assuming it is because there is no interactive logon and the
service can't interact with the desktop.

Is there a way to send email throuhg Outlook without having an interactive
logon or access to the desktop?

Here is my code that sends the email:

Outlook._Application pOutlook = new Outlook.ApplicationClass();

object oMail = pOutlook.CreateItem(Outlook.OlItemType.olMailItem);

Outlook.MailItem pMailItem = oMail as Outlook.MailItem;

if(pMailItem != null)
{
pMailItem.Subject = strEmailSubject;
pMailItem.Body = strEmailBody;
pMailItem.Recipients.Add(strEmailAddress);

pMailItem.Send();
}

Here is the error message I am getting from the exception that is being
thrown:

Error Message: Unable to perform the operation. The server is not available.
Contact your administrator if this condition persists. Could not complete
the operation because the service provider does not support it.

Error Source: Microsoft Outlook



Any help would be great. Thanks,

Brian


  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off