Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Sending Email

Posted on 2006-04-06
3
Medium Priority
?
151 Views
Last Modified: 2010-04-23
I have a vb.net application that I need to send an email, with attachment. I'm not sure on which approach to take. I found some code online that worked, but it uses outlook to send the message. But, this application will be distributed to many clients. Is there a way to send an email and have the email message sent using any default mail client? For instance, MAPI, etc?
0
Comment
Question by:Gary2397
3 Comments
 
LVL 64

Expert Comment

by:Fernando Soto
ID: 16395731
Hi Gary2397;

This code should use the default SMTP server.

Imports System.Web.Mail

        ' Send the message
        _Message = New MailMessage
        With _Message
            .From = txtFrom.Text
            .To = txtTo.Text
            .Subject = txtSubject.Text
            If rbHTML.Checked Then
                .BodyFormat = MailFormat.Html
            Else
                .BodyFormat = MailFormat.Text
            End If
            .Body = txtMessage.Text
            ' Attaching a test file
            .Attachments.Add(New MailAttachment("C:\Temp\txt1.txt"))
        End With
        SmtpMail.Send(_Message)


Fernando
0
 

Author Comment

by:Gary2397
ID: 16396207
Will this send the email directly? Or, if the user has Outlook, by default,will this send to the outbox. If the user is using Outlook, I need to be able to send to outbox.
 
0
 
LVL 48

Accepted Solution

by:
Mikal613 earned 1500 total points
ID: 16396508
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question