473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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 1475
* larry mckay <la***@larrymckay.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.Attachments.Add(New MailAttachment(<Path>))
SmtpMail.Send(mailmsg)
///

--
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*****@optonline.net"

msg.From = "be*****@cherwellinc.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\visual basic notes.doc"

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

msg.Cc = "we*******@cherwellinc.com"

SmtpMail.SmtpServer = "smtp.registeredsite.com"

Try

SmtpMail.Send(msg)

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

HTH,

Bernie Yaeger

"larry mckay" <la***@larrymckay.com> wrote in message
news:eG**************@TK2MSFTNGP09.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
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
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,...
1
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...
0
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...
4
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. --->...
6
by: Anuradha | last post by:
Dear All How can i send mails using vb.net Thanx all
7
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...
5
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...
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 attachment on it. The PDF size vary overtime. The...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
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...
0
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...
0
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
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
0
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...
0
isladogs
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...

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.