Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > emailing in ASP.NET

Reply
Thread Tools

emailing in ASP.NET

 
 
Farooq Khan
Guest
Posts: n/a
 
      12-29-2003
hi,
i'm using CDONTS component for emailing through one of my web service like
this

// Start of code
// 'email' is the CDONTS object name

email.send(EmailFrom.ToString(), EmailTo.ToString(), Subject.ToString(),
Body.ToString(), 1)

// End of code


the above call throws an exception with the message saying "Access is
denied.". i'm using Windows 2000 Professional. don't know what i'm doing
wrong over here. help me on this!!!

Thanks.

Farooq Khan


 
Reply With Quote
 
 
 
 
Farooq Khan
Guest
Posts: n/a
 
      12-29-2003
i have even tried using Web.SmtpMail class' send() method for this.....but
it throws "Could not access 'CDO.Message' object." exception.



"Farooq Khan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> hi,
> i'm using CDONTS component for emailing through one of my web service like
> this
>
> // Start of code
> // 'email' is the CDONTS object name
>
> email.send(EmailFrom.ToString(), EmailTo.ToString(), Subject.ToString(),
> Body.ToString(), 1)
>
> // End of code
>
>
> the above call throws an exception with the message saying "Access is
> denied.". i'm using Windows 2000 Professional. don't know what i'm doing
> wrong over here. help me on this!!!
>
> Thanks.
>
> Farooq Khan
>
>



 
Reply With Quote
 
 
 
 
Hans Kesting
Guest
Posts: n/a
 
      12-29-2003

"Farooq Khan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> i have even tried using Web.SmtpMail class' send() method for this.....but
> it throws "Could not access 'CDO.Message' object." exception.
>
>


This "Could not access" message seems to be a general error message. The
system
usually CAN access that message object, the problem is further down.
Somewhere in the InnerException list there are probably more useful
errormessages.

Hans Kesting


 
Reply With Quote
 
Prodip Saha
Guest
Posts: n/a
 
      12-29-2003
Here is the function to send mail. Be sure to use System.Web.Mail namespace.

Prodip Saha

public bool SendSMTPMail(string strSMTPServer, string strFrom, string strTo,
string strSubject, string strBody, string strCC, string strBCC, string
strAttachmentList, bool blnUseHTML)
{
bool blnTemp=false;
try
{
MailMessage objMsg = new MailMessage();
objMsg.From = strFrom;
objMsg.To = strTo;
objMsg.Subject = strSubject;
objMsg.Body = strBody;
if (strCC !="")
{
objMsg.Cc = strCC;
}
if (strBCC !="")
{
objMsg.Bcc = strBCC;
}
if(blnUseHTML==true)
{
objMsg.BodyFormat=MailFormat.Html;
}
else
{
objMsg.BodyFormat=MailFormat.Text;
}

// Build an IList of mail attachments.
//A list of files separated by comma(,)
if (strAttachmentList != "")
{
char[] delim = new char[] {','};
foreach (string sSubstr in strAttachmentList.Split(delim))
{
MailAttachment attachment = new MailAttachment(sSubstr);
objMsg.Attachments.Add(attachment);
}
}

SmtpMail.SmtpServer = strSMTPServer;
SmtpMail.Send(objMsg);
blnTemp=true;

return blnTemp;

}
catch(Exception ex)
{
throw ex;
}
}

"Farooq Khan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> hi,
> i'm using CDONTS component for emailing through one of my web service like
> this
>
> // Start of code
> // 'email' is the CDONTS object name
>
> email.send(EmailFrom.ToString(), EmailTo.ToString(), Subject.ToString(),
> Body.ToString(), 1)
>
> // End of code
>
>
> the above call throws an exception with the message saying "Access is
> denied.". i'm using Windows 2000 Professional. don't know what i'm doing
> wrong over here. help me on this!!!
>
> Thanks.
>
> Farooq Khan
>
>



 
Reply With Quote
 
Farooq Khan
Guest
Posts: n/a
 
      12-30-2003
thanks saha,
but it doesn't work either. infact that's exactly what i have been doing.
dont know what is wrong with it. anyway thanks for ur help.

Farooq Khan


"Prodip Saha" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Here is the function to send mail. Be sure to use System.Web.Mail

namespace.
>
> Prodip Saha
>
> public bool SendSMTPMail(string strSMTPServer, string strFrom, string

strTo,
> string strSubject, string strBody, string strCC, string strBCC, string
> strAttachmentList, bool blnUseHTML)
> {
> bool blnTemp=false;
> try
> {
> MailMessage objMsg = new MailMessage();
> objMsg.From = strFrom;
> objMsg.To = strTo;
> objMsg.Subject = strSubject;
> objMsg.Body = strBody;
> if (strCC !="")
> {
> objMsg.Cc = strCC;
> }
> if (strBCC !="")
> {
> objMsg.Bcc = strBCC;
> }
> if(blnUseHTML==true)
> {
> objMsg.BodyFormat=MailFormat.Html;
> }
> else
> {
> objMsg.BodyFormat=MailFormat.Text;
> }
>
> // Build an IList of mail attachments.
> //A list of files separated by comma(,)
> if (strAttachmentList != "")
> {
> char[] delim = new char[] {','};
> foreach (string sSubstr in strAttachmentList.Split(delim))
> {
> MailAttachment attachment = new MailAttachment(sSubstr);
> objMsg.Attachments.Add(attachment);
> }
> }
>
> SmtpMail.SmtpServer = strSMTPServer;
> SmtpMail.Send(objMsg);
> blnTemp=true;
>
> return blnTemp;
>
> }
> catch(Exception ex)
> {
> throw ex;
> }
> }
>
> "Farooq Khan" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > hi,
> > i'm using CDONTS component for emailing through one of my web service

like
> > this
> >
> > // Start of code
> > // 'email' is the CDONTS object name
> >
> > email.send(EmailFrom.ToString(), EmailTo.ToString(), Subject.ToString(),
> > Body.ToString(), 1)
> >
> > // End of code
> >
> >
> > the above call throws an exception with the message saying "Access is
> > denied.". i'm using Windows 2000 Professional. don't know what i'm doing
> > wrong over here. help me on this!!!
> >
> > Thanks.
> >
> > Farooq Khan
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Semi-OT: AF's emailing me Briscobar MCSE 2 09-06-2005 03:27 PM
Cisco 3000 vpn concentrator emailing logon events remco Cisco 0 01-18-2005 02:13 PM
emailing passwords using .NET Stephen ASP .Net 2 07-23-2004 09:45 AM
.NET emailing problem Mark Rodseth ASP .Net 2 04-27-2004 10:47 AM
Application_Error not emailing at global.asax tafs7 ASP .Net 3 12-22-2003 11:10 PM



Advertisments