Hi, friends,
I have a function which send email with attachments as the follows:
public int SendEmailWithAttachment(string fromEmailAddress,
string toEmailAddress, string subject, string message, string attachment)
{
System.Web.Mail.MailMessage mm = new System.Web.Mail.MailMessage();
mm.From = fromEmailAddress;
mm.To = toEmailAddress;
mm.Subject = subject;
mm.Body = message;
mm.BodyFormat = System.Web.Mail.MailFormat.Text;
mm.Priority = System.Web.Mail.MailPriority.Normal;
mm.BodyEncoding = System.Text.Encoding.Default;
mm.UrlContentBase = "";
mm.UrlContentLocation = "";
if (attachment.Trim() != "")
{
char[] delim = new char[] {','};
foreach (string sSubstr in attachment.Split(delim))
{
System.Web.Mail.MailAttachment ma = new
System.Web.Mail.MailAttachment(sSubstr);
mm.Attachments.Add(ma);
}
}
System.Web.Mail.SmtpMail.SmtpServer = ""; //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. 3 2253
wrong group!
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:B2**********************************@microsof t.com... Hi, friends,
I have a function which send email with attachments as the follows:
public int SendEmailWithAttachment(string fromEmailAddress, string toEmailAddress, string subject, string message, string attachment) { System.Web.Mail.MailMessage mm = new System.Web.Mail.MailMessage(); mm.From = fromEmailAddress; mm.To = toEmailAddress; mm.Subject = subject; mm.Body = message; mm.BodyFormat = System.Web.Mail.MailFormat.Text; mm.Priority = System.Web.Mail.MailPriority.Normal; mm.BodyEncoding = System.Text.Encoding.Default; mm.UrlContentBase = ""; mm.UrlContentLocation = "";
if (attachment.Trim() != "") { char[] delim = new char[] {','}; foreach (string sSubstr in attachment.Split(delim)) { System.Web.Mail.MailAttachment ma = new System.Web.Mail.MailAttachment(sSubstr); mm.Attachments.Add(ma); } }
System.Web.Mail.SmtpMail.SmtpServer = ""; //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.
Could you please tell me more, I am not sure I understand...
Thanks.
"Dino Chiesa [Microsoft]" wrote: wrong group!
"Andrew" <An****@discussions.microsoft.com> wrote in message news:B2**********************************@microsof t.com... Hi, friends,
I have a function which send email with attachments as the follows:
public int SendEmailWithAttachment(string fromEmailAddress, string toEmailAddress, string subject, string message, string attachment) { System.Web.Mail.MailMessage mm = new System.Web.Mail.MailMessage(); mm.From = fromEmailAddress; mm.To = toEmailAddress; mm.Subject = subject; mm.Body = message; mm.BodyFormat = System.Web.Mail.MailFormat.Text; mm.Priority = System.Web.Mail.MailPriority.Normal; mm.BodyEncoding = System.Text.Encoding.Default; mm.UrlContentBase = ""; mm.UrlContentLocation = "";
if (attachment.Trim() != "") { char[] delim = new char[] {','}; foreach (string sSubstr in attachment.Split(delim)) { System.Web.Mail.MailAttachment ma = new System.Web.Mail.MailAttachment(sSubstr); mm.Attachments.Add(ma); } }
System.Web.Mail.SmtpMail.SmtpServer = ""; //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.
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.public.dotnet.framework
a more general group.
-D
"Andrew" <An****@discussions.microsoft.com> wrote in message
news:91**********************************@microsof t.com... Could you please tell me more, I am not sure I understand... Thanks.
"Dino Chiesa [Microsoft]" wrote:
wrong group!
"Andrew" <An****@discussions.microsoft.com> wrote in message news:B2**********************************@microsof t.com... > Hi, friends, > > I have a function which send email with attachments as the follows: > > public int SendEmailWithAttachment(string > fromEmailAddress, > string toEmailAddress, string subject, string message, string > attachment) > { > System.Web.Mail.MailMessage mm = new System.Web.Mail.MailMessage(); > mm.From = fromEmailAddress; > mm.To = toEmailAddress; > mm.Subject = subject; > mm.Body = message; > mm.BodyFormat = System.Web.Mail.MailFormat.Text; > mm.Priority = System.Web.Mail.MailPriority.Normal; > mm.BodyEncoding = System.Text.Encoding.Default; > mm.UrlContentBase = ""; > mm.UrlContentLocation = ""; > > if (attachment.Trim() != "") > { > char[] delim = new char[] {','}; > foreach (string sSubstr in attachment.Split(delim)) > { > System.Web.Mail.MailAttachment ma = new > System.Web.Mail.MailAttachment(sSubstr); > mm.Attachments.Add(ma); > } > } > > System.Web.Mail.SmtpMail.SmtpServer = ""; //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. > > > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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...
|
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...
|
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();...
|
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
|
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...
|
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...
|
by: FAQ server |
last post by:
-----------------------------------------------------------------------
FAQ Topic - What books cover EcmaScript?
-----------------------------------------------------------------------
Most CLJ...
|
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),...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shllpp 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |