How to create and display email message?

I am trying to create an email message from a VB.NET 2005 app. I am attaching a file and would like to display the email message to the user so that they can edit the message as well as enter the send to address.

There seems to be a ton of examples on how to create AND SEND an email directly from code,but I don't want to send it! Just create it and display it and allow the user to edit.

Do I have to use Outlook and automation? I would rather use the System.Net.Mail functions if possible.

Thanks,

Jim

[615 byte] By [JimShipley] at [2007-12-22]
# 1

interesting.

you can have an "editor" customely created for example, so you can have a "send, cc, subject, body, attachments" field.

if you don't want to send it, then don't call the Smtp.Send() method at all.

Create the MailMessage object, apply the values to the properties and do whatever you like after it.

I guess it's a bit tricky to explain.

As said above, you can create your own "email editor". Then, you can create a MailMessage object and set the properties to whatever you like.

If you want to "edit" a MailMessage, just make sure you have the MailMessage object already containing values in the fields, or at least having an instance of it, then simply "bind" the values from the MailMessage object to your text editor fields.

I hope this makes sense in some way.

ahmedilyas at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 2

Here is a simple example I'm using to do it.

Dim message As New MailMessage(SenderMail, TargetMailAddress, ObjectString , txtBodyMessage)

Dim emailClient As New SmtpClient(MailServer)

message.Priority = MailPriority.High

emailClient.Send(message)

message = Nothing

emailClient = Nothing

SenderMail, TargetMailAddress, ObjectString , txtBodyMessage Are variables you have to set with you data. It could be a simple user editor with 4 texboxes and a button to send the mail for example.

If what you want is an Outlook Style mails management with folder storaging, messages files and so on... I think you have to use OUTLOOK interop.

I hope this could help you.

Dario

DarioGalvani at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic Language...
# 3

I understand what you are saying. Just create a form with the fields for subject, to, and so forth. Then use these for arguments in the .Send method.

That would work.

Thanks!

JimShipley at 2007-8-30 > top of Msdn Tech,Visual Basic,Visual Basic Language...