473,397 Members | 1,972 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,397 software developers and data experts.

Create Email, attach file and send using default mail client ...

Hello,

Is there a way of creating an email, attaching a file and sending using the
client's default mail client?

I am looking for a none email client specific solution that does not involve
specifying parameters such as mail servers etc.

Cheers,

Landers
Nov 21 '05 #1
2 10653
Hi Landley,

Almost, but you have to have an smtp server reference, or else the system
does not know what it is. You could find some esoteric way to query the
current accounts inside Outlook or Outlook Express, but even the query
wouldn't know if that were a valid smtp server.

Here's the easiest way to do it:
Begin your class with a reference to system.web.mail:
Imports System.Web.Mail

Then add the code as appropriate:
Dim msg As New MailMessage

msg.To = "be*****@xxxx.net"

msg.From = "MN***@xxxxx.com"

msg.Subject = "test subject"

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))

Dim astring3 As String = "\\imcsql\data\imcapps\sqldiag.txt"

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

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

SmtpMail.SmtpServer = "mail.xxxxx.com"

Try

SmtpMail.Send(msg)

Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

HTH,

Bernie Yaeger

"Landley" <ne**@creations-software.co.uk> wrote in message
news:u$**************@TK2MSFTNGP11.phx.gbl...
Hello,

Is there a way of creating an email, attaching a file and sending using
the
client's default mail client?

I am looking for a none email client specific solution that does not
involve
specifying parameters such as mail servers etc.

Cheers,

Landers

Nov 21 '05 #2
Landley,

Not using the default mail client in the way you said, when you are sure
that is Office Outlook than you can using the interop too that.

For sending mail with attachment, you can use Bernie's sugestion, however
be aware that for that you should have at least NT5x clients and the mail is
not saved in the users mailclient.

When you search this newsgroup you will find tons of questions about this.

Cor

"Landley"
Hello,

Is there a way of creating an email, attaching a file and sending using
the
client's default mail client?

I am looking for a none email client specific solution that does not
involve
specifying parameters such as mail servers etc.

Cheers,

Landers

Nov 21 '05 #3

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

Similar topics

15
by: tabonni | last post by:
Hi I try to grab the checked files from HTML page and then send those PDF files as attachments. It can just send email, there are no PDF files attached. Can anybody point out my error? My...
5
by: nate heaton | last post by:
I would like to do the following with C# in my asp.net app: Open the default email client of the user (just like a mailto: link would). Supply the subject line and put some HTML (including an...
88
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
1
by: vijaygparikh | last post by:
HI i am writting a code for open default mail client and it works fine. i want to attach a file with the default mail client but file is not attached with "mailto:" option. If any one has idea...
1
by: Amy L. | last post by:
I am working on creating a web service that will create a signed xml file. I would like to create this file in memory and than somehow email it to the user that requested it to be generated. I...
7
by: Darin | last post by:
Currently, our software is creating an email message using the Outlook DLL to send emails out that have PDF attachments. I want to stop forcing the customer to use outlook to send email. So, I...
12
by: cj | last post by:
What's the parameter (like ?attachment) or something.
2
by: Hanika | last post by:
Going on 3 days and I am wodnering if I am just not looking in the right place. If anyone nows how to do this please please help me. I am developing a Windows form application using VB.NET 2005....
3
by: =?Utf-8?B?SHVnaA==?= | last post by:
Hi There, I use follow code to send email inside VB.NET 2005. It does not work well. Error message of "Failure sending email" would occue. However, email was sent out sometimes. I am confused...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...
0
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,...
0
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...

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.