473,941 Members | 30,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What is wrong here?

Hi, friends,

I have a function which send email with attachments as the follows:

public int SendEmailWithAt tachment(string fromEmailAddres s,
string toEmailAddress, string subject, string message, string attachment)
{
System.Web.Mail .MailMessage mm = new System.Web.Mail .MailMessage();
mm.From = fromEmailAddres s;
mm.To = toEmailAddress;
mm.Subject = subject;
mm.Body = message;
mm.BodyFormat = System.Web.Mail .MailFormat.Tex t;
mm.Priority = System.Web.Mail .MailPriority.N ormal;
mm.BodyEncoding = System.Text.Enc oding.Default;
mm.UrlContentBa se = "";
mm.UrlContentLo cation = "";

if (attachment.Tri m() != "")
{
char[] delim = new char[] {','};
foreach (string sSubstr in attachment.Spli t(delim))
{
System.Web.Mail .MailAttachment ma = new
System.Web.Mail .MailAttachment (sSubstr);
mm.Attachments. Add(ma);
}
}

System.Web.Mail .SmtpMail.SmtpS erver = ""; //default
System.Web.Mail .SmtpMail.Send( mm);
return 1;
}

It works fine if there is only one attachment file. However, if there are
two or more files, I got an error saying:
Could not access 'CDO.Message' object.

But, I really could not find what was wrong. Any ideas, suggestions, etc.?
Thanks a lot.

Nov 21 '05 #1
3 2315
wrong group!

"Andrew" <An****@discuss ions.microsoft. com> wrote in message
news:B2******** *************** ***********@mic rosoft.com...
Hi, friends,

I have a function which send email with attachments as the follows:

public int SendEmailWithAt tachment(string fromEmailAddres s,
string toEmailAddress, string subject, string message, string attachment)
{
System.Web.Mail .MailMessage mm = new System.Web.Mail .MailMessage();
mm.From = fromEmailAddres s;
mm.To = toEmailAddress;
mm.Subject = subject;
mm.Body = message;
mm.BodyFormat = System.Web.Mail .MailFormat.Tex t;
mm.Priority = System.Web.Mail .MailPriority.N ormal;
mm.BodyEncoding = System.Text.Enc oding.Default;
mm.UrlContentBa se = "";
mm.UrlContentLo cation = "";

if (attachment.Tri m() != "")
{
char[] delim = new char[] {','};
foreach (string sSubstr in attachment.Spli t(delim))
{
System.Web.Mail .MailAttachment ma = new
System.Web.Mail .MailAttachment (sSubstr);
mm.Attachments. Add(ma);
}
}

System.Web.Mail .SmtpMail.SmtpS erver = ""; //default
System.Web.Mail .SmtpMail.Send( mm);
return 1;
}

It works fine if there is only one attachment file. However, if there are
two or more files, I got an error saying:
Could not access 'CDO.Message' object.

But, I really could not find what was wrong. Any ideas, suggestions, etc.?
Thanks a lot.

Nov 21 '05 #2
Could you please tell me more, I am not sure I understand...
Thanks.

"Dino Chiesa [Microsoft]" wrote:
wrong group!

"Andrew" <An****@discuss ions.microsoft. com> wrote in message
news:B2******** *************** ***********@mic rosoft.com...
Hi, friends,

I have a function which send email with attachments as the follows:

public int SendEmailWithAt tachment(string fromEmailAddres s,
string toEmailAddress, string subject, string message, string attachment)
{
System.Web.Mail .MailMessage mm = new System.Web.Mail .MailMessage();
mm.From = fromEmailAddres s;
mm.To = toEmailAddress;
mm.Subject = subject;
mm.Body = message;
mm.BodyFormat = System.Web.Mail .MailFormat.Tex t;
mm.Priority = System.Web.Mail .MailPriority.N ormal;
mm.BodyEncoding = System.Text.Enc oding.Default;
mm.UrlContentBa se = "";
mm.UrlContentLo cation = "";

if (attachment.Tri m() != "")
{
char[] delim = new char[] {','};
foreach (string sSubstr in attachment.Spli t(delim))
{
System.Web.Mail .MailAttachment ma = new
System.Web.Mail .MailAttachment (sSubstr);
mm.Attachments. Add(ma);
}
}

System.Web.Mail .SmtpMail.SmtpS erver = ""; //default
System.Web.Mail .SmtpMail.Send( mm);
return 1;
}

It works fine if there is only one attachment file. However, if there are
two or more files, I got an error saying:
Could not access 'CDO.Message' object.

But, I really could not find what was wrong. Any ideas, suggestions, etc.?
Thanks a lot.


Nov 21 '05 #3
you are posting to the wrong newsgroup.
If I am not mistaken, you are asking about System.Web.Mail , and CDO;
this newsgroup covers webservices.

I suggest something like
microsoft.publi c.dotnet.framew ork
a more general group.

-D

"Andrew" <An****@discuss ions.microsoft. com> wrote in message
news:91******** *************** ***********@mic rosoft.com...
Could you please tell me more, I am not sure I understand...
Thanks.

"Dino Chiesa [Microsoft]" wrote:
wrong group!

"Andrew" <An****@discuss ions.microsoft. com> wrote in message
news:B2******** *************** ***********@mic rosoft.com...
> Hi, friends,
>
> I have a function which send email with attachments as the follows:
>
> public int SendEmailWithAt tachment(string
> fromEmailAddres s,
> string toEmailAddress, string subject, string message, string
> attachment)
> {
> System.Web.Mail .MailMessage mm = new System.Web.Mail .MailMessage();
> mm.From = fromEmailAddres s;
> mm.To = toEmailAddress;
> mm.Subject = subject;
> mm.Body = message;
> mm.BodyFormat = System.Web.Mail .MailFormat.Tex t;
> mm.Priority = System.Web.Mail .MailPriority.N ormal;
> mm.BodyEncoding = System.Text.Enc oding.Default;
> mm.UrlContentBa se = "";
> mm.UrlContentLo cation = "";
>
> if (attachment.Tri m() != "")
> {
> char[] delim = new char[] {','};
> foreach (string sSubstr in attachment.Spli t(delim))
> {
> System.Web.Mail .MailAttachment ma = new
> System.Web.Mail .MailAttachment (sSubstr);
> mm.Attachments. Add(ma);
> }
> }
>
> System.Web.Mail .SmtpMail.SmtpS erver = ""; //default
> System.Web.Mail .SmtpMail.Send( mm);
> return 1;
> }
>
> It works fine if there is only one attachment file. However, if there
> are
> two or more files, I got an error saying:
> Could not access 'CDO.Message' object.
>
> But, I really could not find what was wrong. Any ideas, suggestions,
> etc.?
> Thanks a lot.
>
>
>


Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

125
14986
by: Sarah Tanembaum | last post by:
Beside its an opensource and supported by community, what's the fundamental differences between PostgreSQL and those high-price commercial database (and some are bloated such as Oracle) from software giant such as Microsoft SQL Server, Oracle, and Sybase? Is PostgreSQL reliable enough to be used for high-end commercial application? Thanks
72
5947
by: E. Robert Tisdale | last post by:
What makes a good C/C++ programmer? Would you be surprised if I told you that it has almost nothing to do with your knowledge of C or C++? There isn't much difference in productivity, for example, between a C/C++ programmers with a few weeks of experience and a C/C++ programmer with years of experience. You don't really need to understand the subtle details or use the obscure features of either language
17
2669
by: Paul | last post by:
HI! I get an error with this code. <SCRIPT language="JavaScript"> If (ifp==""){ ifp="default.htm"} //--></SCRIPT> Basicly I want my iframe to have a default page if the user enters in directly. so I need a way doing this. so I check to see if the ifp value is null and if so then assign it a value. is this correct?
121
10301
by: typingcat | last post by:
First of all, I'm an Asian and I need to input Japanese, Korean and so on. I've tried many PHP IDEs today, but almost non of them supported Unicode (UTF-8) file. I've found that the only Unicode support IDEs are DreamWeaver 8 and Zend PHP Studio. DreamWeaver provides full support for Unicode. However, DreamWeaver is a web editor rather than a PHP IDE. It only supports basic IntelliSense (or code completion) and doesn't have anything...
28
3302
by: Madhur | last post by:
Hello what about this nice way to open a file in single line rather than using if and else. #include<stdio.h> void main() { FILE *nd; clrscr(); fopen("c:\\autoexec.bat","r")&&printf("success") || printf("error opeing
13
5083
by: Jason Huang | last post by:
Hi, Would someone explain the following coding more detail for me? What's the ( ) for? CurrentText = (TextBox)e.Item.Cells.Controls; Thanks. Jason
669
26609
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic paper written on this subject. On the Expressive Power of Programming Languages, by Matthias Felleisen, 1990. http://www.ccs.neu.edu/home/cobbe/pl-seminar-jr/notes/2003-sep-26/expressive-slides.pdf
3
2162
by: Siong.Ong | last post by:
Dear all, my PHP aims to update a MySQL database by selecting record one by one and modify then save. Here are my PHP, but I found that it doesnt work as it supposed to be, for example, when Record (i) is shown and modified, the change will come to Record (i+1). Can anyone provide suggestion? thanks.
38
2031
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - What books cover EcmaScript? ----------------------------------------------------------------------- Most CLJ regulars believe the best book to be: JavaScript: The Definitive Guide, 5th Edition By David Flanagan ISBN:0-596-10199-6 The errata should be read along with the book.
16
3462
by: John Doe | last post by:
Hi, I wrote a small class to enumerate available networks on a smartphone : class CNetwork { public: CNetwork() {}; CNetwork(CString& netName, GUID netguid): _netname(netName), _netguid(netguid) {}
0
11530
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11113
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9858
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7389
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6080
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6298
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4908
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4450
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3507
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.