How do I save an email (in msg format), created using the MailMessage Constructor

S

Stephen Miller

I have used the following code to create and send an email using the
MailMessage Constructor:

'-- Imports System.Web.Mail
Dim oMail As New MailMessage()
With oMail
.From = "(e-mail address removed)"
.To = "(e-mail address removed)
.Subject = "My message"
.Body = "This is my message"
.Priority = MailPriority.High
End With

SmtpMail.SmtpServer = "mail.this.com"
SmtpMail.Send(oMail)


However, I can't seem to find a way to save the email (preferably in
msg format) prior to sending. Is this possible?
 
O

One Handed Man \( OHM - Terry Burns \)

I would wrap this class and use XML to save it. I'm not sure about the
attachment though

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
B

Bernie Yaeger

Hi Stephen,

Doesn't look like there are any methods to do anything like that.

I'd do a try catch on the .send method; if it works, I'd save to .to.
..subject etc in a table; I'd add any attachments as string references (full
path) in the table as well, looping through if there are several and saving
those to an auxiliary and linked table, linked on a 'time sent' key.

HTH,

Bernie Yaeger
 
O

One Handed Man \( OHM - Terry Burns \)

Have not read it fully, doesent look like if contains things about
attachments.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 
C

Cor Ligthert

Hi Terry,

I thought you was on a contract, however this is not about an attachment I
thought.

I made a message yesterday and than I saw it was about the msg format. I
would not know how to save it that way in another way than in a kind of
textformat, so I was waiting to see if there was someone who had a delighted
idea.

Normally it is in my opinion just saving the mail in a database before you
write it using smtpserver in my opinion. (And when you have exchange server
in the database exchange).

Cor
 
O

One Handed Man \( OHM - Terry Burns \)

Yes, I understand now. I am leaving for work in about 10 minutes as my start
time is 09:30

Cheers

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .

Time flies when you don't know what you're doing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top