473,837 Members | 1,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 .LateBoundAcces sHelper.CallMet hod(Object obj, String
methodName, Object[] args) at System.Web.Mail .CdoSysHelper.S end(MailMessage
message) at System.Web.Mail .SmtpMail.Send( MailMessage message) at
GlendaleInfo.Re adFile.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(MailAttac hments, ",")

For j = 0 To UBound(FilesToA ttach)
' Create the mail attachment
Dim oMailAttachment As MailAttachment = New
MailAttachment( FilesToAttach(j ))
' Adding the attachment/s to the email message
oMail.Attachmen ts.Add(oMailAtt achment)

SmtpMail.SmtpSe rver = ""
End If

' Create de message
'oMail = New MailMessage
oMail.To = SendTo
oMail.From = SentFrom
' Body format
oMail.BodyForma t = MessageType
oMail.Priority = MailPriority.Hi gh
'Message subject
oMail.Subject = MessageSubject
' Message body
oMail.Body = MessageBody
'sending e message
SmtpMail.Send(o Mail)
Nov 17 '05 #1
0 1491

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

Similar topics

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 when I try to open it saying it is corrupt. Obviuosly, the file is fine on the server, so the attachment code I am using must be corrupting it, but I dont know what it is: // send email with attachment function emailAttachment($to, $subject, $message, $name, $email,
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 build an applet that would be similar, but much simpler, than Hotmail or Webmail. I've been told by our system administrator that I can't access our SMTP and POP3 servers directly. If I could use SMTP or POP3, this problem would be trivial, I think. But instead, I'm forced to rely on the HTTP...
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, line 688, in sendmail * Module smtplib, line 485, in data * Module smtplib, line 312, in send * Module socket, line 1, in sendall
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 like to move this application into Access 2003. But when I did it, sending email code doesn`t work. Can you be so kind and give me the code how to send email with and without attachment in vb in Access 2003?? Thank you in advance
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
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 attachment on it. The PDF size vary overtime. The problem is that everytime the PDF size is equal to or less than 200 KB, the email is just not being sent. There are no error messages, nothing. Here is a piece of code.
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. Language - VB Below is the Code I'm using for doing the same. Dim Maildb As Object
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 searched a lot in Google, but ican't get any details. Pls its urgent for me. Can any one give me any idea about this. Thanks in advance Pari
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 message 550-5.7.1 the ip you’re using to send mail is not authorized" i have configure smtp server put ip in relay and also put ip in connection. using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing;
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
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...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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 project—planning, coding, testing, and deployment—without 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...
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();...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
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.