Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > save send email as file

Reply
Thread Tools

save send email as file

 
 
=?Utf-8?B?TWFyYyBIb2Vpam1hbnM=?=
Guest
Posts: n/a
 
      03-24-2006
Hi,
We like to save the emails we send as textfile on a file server. I want to
use the System. Web.Mail class for sending the email. The question is how can
i save the message as file. I have tried to use the msgMail.ToString() method
but this won't help, or i have to type cast te MailMessage as a string, but i
donýt know how to do this.

Thanks,
Marc
 
Reply With Quote
 
 
 
 
Spam Catcher
Guest
Posts: n/a
 
      03-24-2006
=?Utf-8?B?TWFyYyBIb2Vpam1hbnM=?=
<(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> Hi,
> We like to save the emails we send as textfile on a file server. I
> want to use the System. Web.Mail class for sending the email. The
> question is how can i save the message as file. I have tried to use
> the msgMail.ToString() method but this won't help, or i have to type
> cast te MailMessage as a string, but i donýt know how to do this.



NSoftware's SMTP component or FreeSMTP.net can save an e-mail to a file.

--
Stan Kee ((E-Mail Removed))

Boycott StarForce!
http://www.glop.org/starforce
 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
Guest
Posts: n/a
 
      03-24-2006
After you sent the Message you can use its various properties to compose the
content to save in a file that looks like the email you sent:

Private Sub WriteEmailToAFile( _
ByVal Message As System.Web.Mail.MailMessage, _
ByVal strFilePath As String)
Dim sw As System.IO.StreamWriter = _
New System.IO.StreamWriter(strFilePath)
sw.Write("<html><head></head><body>")
sw.Write("<p>Date: " & Now.ToLongDateString & _
" @ " & Now.ToLongTimeString & "</p>")
sw.Write("<P>To:" & Message.To & "</p>")
sw.Write("<p>From: " & Message.From & "</p>")
sw.Write("<p>Subject: " & Message.Subject & "</p>")
sw.Write("<div>Body: " & Message.Body & "</div>")
sw.Write("</body></html>")
sw.Close()
End Sub

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


"Marc Hoeijmans" wrote:

> Hi,
> We like to save the emails we send as textfile on a file server. I want to
> use the System. Web.Mail class for sending the email. The question is how can
> i save the message as file. I have tried to use the msgMail.ToString() method
> but this won't help, or i have to type cast te MailMessage as a string, but i
> donýt know how to do this.
>
> Thanks,
> Marc

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to have email form send email and start file download bmurphy@xlrotor.com Javascript 13 05-14-2006 06:27 PM
Cannot compose ,reply or send email on Sasktel email system pcbutts1 Computer Support 5 07-29-2005 06:13 AM
why cant i send email messages from this email Billie Jo Ames Computer Support 8 06-30-2005 12:24 PM
Save alternative file on right-click->save-picture-as Shahar Golan Javascript 5 10-16-2003 05:01 PM
HowTo:? open email client to send email Peter ASP .Net 0 07-01-2003 04:58 PM



Advertisments