473,750 Members | 2,557 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 10695
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.n et"

msg.From = "MN***@xxxxx.co m"

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\visua l 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*******@xxxx x.com"

SmtpMail.SmtpSe rver = "mail.xxxxx.com "

Try

SmtpMail.Send(m sg)

Catch ex As Exception

MessageBox.Show (ex.Message)

End Try

HTH,

Bernie Yaeger

"Landley" <ne**@creatio ns-software.co.uk> wrote in message
news:u$******** ******@TK2MSFTN GP11.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
3723
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 idea is: When people check the check boxes in HTML page for the PDF files, it will transfer the files' name to ASP page. Then, it will attach it in the email.
5
4410
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 image) into the body of the email. Any help would be greatly appreciated. -- Nate Heaton
88
12539
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
12662
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 about open default mail client with attach files using "mailto:" then pls reply me. Thanks in Advance. regards
1
7465
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 would prefer a solution that does not require the file to be first wrote to disk or requires the user to save the file from the browser. I know I can create a file using MemoryStream, but I not sure on how to transform that MemroyStream into an...
7
10667
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 know I can use "mailto" to send email, but what methodology should I use to send email using the default mail client WITH an attachment. Thanks Darin
12
2779
by: cj | last post by:
What's the parameter (like ?attachment) or something.
2
31997
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. I have a PDF file that I want to attach to the local default email client and display it so that the user can enter the rest of the information. Like one would see using the right-click Send To Mail Recipient. I tried using MailTo. But the...
3
9741
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 and please help. Thanks in advance. Hugh
0
8838
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
9583
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9396
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
9256
tracyyun
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...
0
8263
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
6808
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
4716
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...
1
3323
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
3
2226
bsmnconsultancy
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.