472,334 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,334 software developers and data experts.

Sending more than one attachment

Recently I tried to develop a function to help me sending e-mail messages
with more than one attachment. Everything is working OK when I am sebding
messages with one attachment, but when I try to send more than one file as
attachment I get the following error:
-------- Error -----------------
Could not access 'CDO.Message' object.
at System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String
methodName, Object[] args) at System.Web.Mail.CdoSysHelper.Send(MailMessage
message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at
GlendaleInfo.ReadFile.SendMail(String SendTo, String SentFrom, String
MessageSubject, String MessageBody, MailFormat MessageType, String
MailAttachments) in ....

----------------> End Error

Here is my code which tries to attach the the files and send the message:
' Creating the email object
Dim oMail As MailMessage = New MailMessage
' Creating the attachment object

'*********************************************
' Checking if there is some attachments
'*********************************************
If MailAttachments <> "" Then
Dim FilesToAttach() As String
Dim j As Integer
FilesToAttach = Split(MailAttachments, ",")

For j = 0 To UBound(FilesToAttach)
' Create the mail attachment
Dim oMailAttachment As MailAttachment = New
MailAttachment(FilesToAttach(j))
' Adding the attachment/s to the email message
oMail.Attachments.Add(oMailAttachment)
Next

SmtpMail.SmtpServer = ""
End If

' Create de message
'oMail = New MailMessage
oMail.To = SendTo
oMail.From = SentFrom
' Body format
oMail.BodyFormat = MessageType
oMail.Priority = MailPriority.High
'Message subject
oMail.Subject = MessageSubject
' Message body
oMail.Body = MessageBody
'sending e message
SmtpMail.Send(oMail)
Nov 17 '05 #1
0 1421

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

Similar topics

3
by: Paul Lamonby | last post by:
Hi, I am sending a file from the server as an email attachment. The file is being attached no problem and sending the email, but I get an error...
3
by: Jared | last post by:
Hello people, I've had major difficulties finding the right Java technology that can be used to make an e-mail applet program. I'm trying to...
5
by: morphex | last post by:
Hi, I have an email that's in the utf-8 encoding, and I'm getting this error message when I try to send it using smtplib: * Module smtplib,...
7
by: Marcin | last post by:
Hello all! A few years ago I created a form with button which let me send an email with an attachment. It was created in Access 97. Now I would...
6
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
2
by: Robson Siqueira | last post by:
Folks, I've been experiencing a weird problem. I have a web service which sends an email after its processing. The email always has an PDF...
0
by: damimkader | last post by:
Hi, I'm trying to send emails using a Macro based on an Excel Sheet and the Email Client I'm using is Lotus Notes. OS used - Windows Xp....
7
by: Paridevi | last post by:
Hai , i want to send email in .Net Using OutLook Express,My Project is Web Application using vb.Net 2003 with SQL Server 2000.I have...
3
by: raj200809 | last post by:
when i m sending mail i received error from symantec Antivirus" Your email message was unable to be sent because your mail server rejected the...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

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.