473,765 Members | 2,019 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sending mail messages with attachments



I'm trying to send mail using the
mail.smptserver ,
mailmessage,
mailattachment objects

I'm having trouble assigning an attachment to before doing an smpt.send
using vb.net

does anyone have any coding samples on how to programatically add mail
attachments using .net

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
2 1500
* larry mckay <la***@larrymck ay.com> scripsit:
I'm trying to send mail using the
mail.smptserver ,
mailmessage,
mailattachment objects

I'm having trouble assigning an attachment to before doing an smpt.send
using vb.net

does anyone have any coding samples on how to programatically add mail
attachments using .net


\\\
....
mailmsg.Attachm ents.Add(New MailAttachment( <Path>))
SmtpMail.Send(m ailmsg)
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Hi Larry,

This worked fine for me:
Dim msg As New MailMessage()

msg.To = "be*****@optonl ine.net"

msg.From = "be*****@cherwe llinc.com"

msg.Subject = "test subject"

msg.Body = "this is the test info"

Dim astring1 As String = "c:\my documents\wzo letter.doc"

msg.Attachments .Add(New MailAttachment( astring1))

Dim astring2 As String = "c:\my documents\visua l basic notes.doc"

msg.Attachments .Add(New MailAttachment( astring2))

msg.Cc = "we*******@cher wellinc.com"

SmtpMail.SmtpSe rver = "smtp.registere dsite.com"

Try

SmtpMail.Send(m sg)

Catch ex As Exception

MessageBox.Show (ex.Message)

End Try

HTH,

Bernie Yaeger

"larry mckay" <la***@larrymck ay.com> wrote in message
news:eG******** ******@TK2MSFTN GP09.phx.gbl...


I'm trying to send mail using the
mail.smptserver ,
mailmessage,
mailattachment objects

I'm having trouble assigning an attachment to before doing an smpt.send
using vb.net

does anyone have any coding samples on how to programatically add mail
attachments using .net

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #3

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

Similar topics

15
4312
by: Sven Templin | last post by:
Hello all, our configuration is as following described: - OS: Windows 2000 - Apache server 1.3 - Php 3.8 - MS outlook client 2000 _and_ no SMTP server available in the whole intranet.
1
3581
by: Google Mike | last post by:
Using Sockets (fsockopen, fputs, fgets, etc.) I'm able to interact with an SMTP server to send mail. However, do you know the steps necessary in order to send a file attachment as well? (Note, if you need GNU tools to help achieve this task, note that I have RH9 Linux.)
1
4171
by: Devonish | last post by:
I am composing an email with Access VB and then sending it from within Access. Everything works correctly (the email actually goes!) but Outlook ask some irritating questions that the user is required to answer. A summary of the relevant code is: Dim mailObj as Outlook.MailItem
0
1488
by: Dragos Marian Barbu | last post by:
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(Object obj, String methodName, Object args) at...
4
3977
by: Liz Patton | last post by:
Here's the exception: System.Exception: Unable to send mail: Could not access 'CDO.Message' object. ---> System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80004005): Unspecified error --- End of inner exception stack trace ---
6
2750
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
7
4388
by: Ray Booysen | last post by:
Hi all I'm sending email via ASP.NET in HTML mode. Each email has exactly one attachment and I do have full access to the SMTP server. However, if I send the email in HTML format, the framework reports the following exception: "System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown
5
2368
by: Robert Dufour | last post by:
I am trying to use framework 1.1 - stuck with it. to send emails from a windows form application. The email messages can have attachments, usually two and they can be either text or sounds (wav files) or images (bmp, gif or tiff) I can send the email messages OK but the attachments are giving me grief. Can anyone provide some code that adds attachments to web mail messages. Thanks for any help,
2
5265
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.
0
9568
marktang
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...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10007
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
8833
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 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...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5277
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
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3926
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
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.