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

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

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 = "fr**@this.com"
.To = "to@this.com
.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?
Nov 20 '05 #1
8 1851
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

"Stephen Miller" <js******@hotmail.com> wrote in message
news:cd**************************@posting.google.c om...
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 = "fr**@this.com"
.To = "to@this.com
.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?

Nov 20 '05 #2
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

"Stephen Miller" <js******@hotmail.com> wrote in message
news:cd**************************@posting.google.c om...
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 = "fr**@this.com"
.To = "to@this.com
.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?

Nov 20 '05 #4
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

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi Terry,

http://www.w3.org/Protocols/rfc822/Overview.html

:-)

Cor

Nov 20 '05 #5
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
Have not read it fully, doesent look like if contains things about
attachments.

Nov 20 '05 #6
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

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uV***************@tk2msftngp13.phx.gbl...
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
Have not read it fully, doesent look like if contains things about
attachments.


Nov 20 '05 #7
Success

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

Cheers

Nov 20 '05 #8
* "One Handed Man \( OHM - Terry Burns \)" <news.microsoft.com> scripsit:
Have not read it fully, doesent look like if contains things about
attachments.


<URL:http://www.mhonarc.org/~ehood/MIME/>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #9

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

Similar topics

0
by: met | last post by:
I want to have the python equivalent function of this (that checks email format) function CheckEmail($Email = "") { if (ereg("]+@]+\.]+", $Email)) { return true; } else { return false; }
1
by: CarlInAl | last post by:
Rather than setting the MailMessage.To and MailMessage.From properties with something like "someName@someDomain.com" I would like to include the name along with the email address. Is something...
5
by: Richard | last post by:
Working in asp.net I send out an email using the following Code: Dim cdoMsg As New System.Web.Mail.MailMessage Dim strEmailBCC As String = "" strEmailBCC =...
2
by: quest | last post by:
I created xml file using XmlTextWriter. When I opened the xml file using binary editor, the first 3 bytes of the xml file consist of EF, BB, BF respectively. Is there any way I can generate the XML...
2
by: Joe George | last post by:
Hi there, How to save email attachments, from exchange, using WebDAV in C#.NET? Sample code please................... Thanks for your help. -- Joe George
1
by: amit saha | last post by:
Hi list! I was designing a GUI App using BOA Constructor. I have designed the User Interface.However I cannot figure out how do i add the event handling code to the buttons and other controls ...
0
by: jackiewkc | last post by:
Hi, Does anyone know how to use VB to write a simple MAPI to save email attachments from a specified email address to my hard drive? What I basically want is that everytime when I receive an...
11
by: Dijkstra | last post by:
Hi folks! First, this is the code I'm using to expose the problem: ------------------------------------------------------------------ #include <functional> #include <string> #include...
1
by: developing | last post by:
Hi, Please bear with me if this sounds like a non-intuitive question. Anyone have any insights as to how System.Net.MailMessage class is implemented? Does it construct a simple C/MIME string...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.