I would like to build a windows app or service that would read a .txt
file and than put the contents of that file in an email and send off
the email. WOuld that be very difficult?...how could this be done? 6 2093
On May 21, 6:10 pm, Jason <paul...@excite.comwrote:
I would like to build a windows app or service that would read a .txt
file and than put the contents of that file in an email and send off
the email. WOuld that be very difficult?...how could this be done?
Hi,
Reading of text file can be done using WebClient's downloadstring
method if the file resides on remote host. If file is local, you can
use StreamReader.
You can send mail with attachments using System.Net.SmtpClient class.
A sample code would be:
' Instantiate SmtpClient Class
Dim emailClient As New SmtpClient("smtp.gmail.com")
' Instantiate MailMessage Class
Dim message As New MailMessage("from_here", "to_here", "subject_here",
"body_here")
message.Attachments.Add(New Attachment("attachment_path_here")
' Credentials here <optional>
' Set credentials using System.Net.NetworkCredential...
' .......
' Send mail
emailClient.Send(message)
Hope this helps,
Onur Güzel
OK...but I dont want to load the file as an attachment.
I want to read, for example \\server\docs\myfile.txt
and than display the contents of file.txt in an email body
On May 21, 11:44*am, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On May 21, 6:10 pm, Jason <paul...@excite.comwrote:
I would like to build a windows app or service that would read a .txt
file and than put the contents of that file in an email and send off
the email. *WOuld that be very difficult?...how could this be done?
Hi,
Reading of text file can be done using WebClient's downloadstring
method if the file resides on remote host. If file is local, you can
use StreamReader.
You can send mail with attachments using System.Net.SmtpClient class.
A sample code would be:
' Instantiate SmtpClient Class
Dim emailClient As New SmtpClient("smtp.gmail.com")
' Instantiate MailMessage Class
Dim message As New MailMessage("from_here", "to_here", "subject_here",
"body_here")
message.Attachments.Add(New Attachment("attachment_path_here")
' Credentials here <optional>
' Set credentials using System.Net.NetworkCredential...
' .......
' Send mail
emailClient.Send(message)
Hope this helps,
Onur Güzel
On May 21, 7:21*pm, Jason <paul...@excite.comwrote:
OK...but I dont want to load the file as an attachment.
I want to read, for example \\server\docs\myfile.txt
and than display the contents of file.txt in an email body
On May 21, 11:44*am, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On May 21, 6:10 pm, Jason <paul...@excite.comwrote:
I would like to build a windows app or service that would read a .txt
file and than put the contents of that file in an email and send off
the email. *WOuld that be very difficult?...how could this be done?
Hi,
Reading of text file can be done using WebClient's downloadstring
method if the file resides on remote host. If file is local, you can
use StreamReader.
You can send mail with attachments using System.Net.SmtpClient class.
A sample code would be:
' Instantiate SmtpClient Class
Dim emailClient As New SmtpClient("smtp.gmail.com")
' Instantiate MailMessage Class
Dim message As New MailMessage("from_here", "to_here", "subject_here",
"body_here")
message.Attachments.Add(New Attachment("attachment_path_here")
' Credentials here <optional>
' Set credentials using System.Net.NetworkCredential...
' .......
' Send mail
emailClient.Send(message)
Hope this helps,
Onur Güzel- Hide quoted text -
- Show quoted text -
Then you'll send the mail within your application, right?
So, place a richtextbox or textbox to download the content from remote
text file;
Dim myclient As New System.Net.WebClient
textbox1.text = myclient.DownloadString("\\server\docs\myfile.txt" )
Now you can set textbox1 as body of your outgoing mail in
MailMessage's constructors:
Dim message As New MailMessage("from", "to", "subject",
textbox1.text)
(see previous post for the rest)
Thanks,
Onur Güzel
On May 21, 11:10 am, Jason <paul...@excite.comwrote:
I would like to build a windows app or service that would read a .txt
file and than put the contents of that file in an email and send off
the email. WOuld that be very difficult?...how could this be done?
If the file is not at a remote location, it would be much easier to
just read the file with a FileStream. You should be able to find
plenty of examples on doing that from the msdn article on FileStream.
For sending it in an email, the place you want to go is www.systemnetmail.com
It will walk you through the steps necessary for sending emails.
Thanks,
Seth Rowe [MVP]
in that case read the content from the txt file using StreamReader and
populate message body.
Also the name space is System.Net.Mail.SmtpClient
Mayur
"Jason" <pa*****@excite.comwrote in message
news:6f**********************************@k30g2000 hse.googlegroups.com...
OK...but I dont want to load the file as an attachment.
I want to read, for example \\server\docs\myfile.txt
and than display the contents of file.txt in an email body
On May 21, 11:44 am, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On May 21, 6:10 pm, Jason <paul...@excite.comwrote:
I would like to build a windows app or service that would read a .txt
file and than put the contents of that file in an email and send off
the email. WOuld that be very difficult?...how could this be done?
Hi,
Reading of text file can be done using WebClient's downloadstring
method if the file resides on remote host. If file is local, you can
use StreamReader.
You can send mail with attachments using System.Net.SmtpClient class.
A sample code would be:
' Instantiate SmtpClient Class
Dim emailClient As New SmtpClient("smtp.gmail.com")
' Instantiate MailMessage Class
Dim message As New MailMessage("from_here", "to_here", "subject_here",
"body_here")
message.Attachments.Add(New Attachment("attachment_path_here")
' Credentials here <optional>
' Set credentials using System.Net.NetworkCredential...
' .......
' Send mail
emailClient.Send(message)
Hope this helps,
Onur Güzel
On May 21, 8:03*pm, "Mayur H Chauhan" <ma...@orioninc.comwrote:
in that case read the content from the txt file using StreamReader and
populate message body.
Also the name space is System.Net.Mail.SmtpClient
Mayur
"Jason" <paul...@excite.comwrote in message
news:6f**********************************@k30g2000 hse.googlegroups.com...
OK...but I dont want to load the file as an attachment.
I want to read, for example \\server\docs\myfile.txt
and than display the contents of file.txt in an email body
On May 21, 11:44 am, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On May 21, 6:10 pm, Jason <paul...@excite.comwrote:
I would like to build a windows app or service that would read a .txt
file and than put the contents of that file in an email and send off
the email. WOuld that be very difficult?...how could this be done?
Hi,
Reading of text file can be done using WebClient's downloadstring
method if the file resides on remote host. If file is local, you can
use StreamReader.
You can send mail with attachments using System.Net.SmtpClient class.
A sample code would be:
' Instantiate SmtpClient Class
Dim emailClient As New SmtpClient("smtp.gmail.com")
' Instantiate MailMessage Class
Dim message As New MailMessage("from_here", "to_here", "subject_here",
"body_here")
message.Attachments.Add(New Attachment("attachment_path_here")
' Credentials here <optional>
' Set credentials using System.Net.NetworkCredential...
' .......
' Send mail
emailClient.Send(message)
Hope this helps,
Onur Güzel- Hide quoted text -
- Show quoted text -
Yes, my typo, correct one is System.Net.Mail.SmtpClient, thanks for
correcting.
Thanks,
Onur This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: John |
last post by:
I have over 5000 thumbnail pictures of size 5kb each. I would like to
able to load all 5000 pictures and view 50 per page using
mysql_data_seek(). ...
|
by: Paul Lamonby |
last post by:
Hi,
I am sending a file from the server as an email attachment. The file
is being attached no problem and sending the email, but I get an error...
|
by: JoKur |
last post by:
Hello,
First let me tell you that I'm very new to C# and learning as I go. I'm
trying to write a client application to communicate with a server...
|
by: Dalibor |
last post by:
I have following code for putting contenst of a file into a web page:
<?php
$filename = "../msd/news.txt";
$handle = fopen ($filename, "r");...
|
by: Macca |
last post by:
Hi,
I have a synchronous socket server which my app uses to read data from
clients.
To test this I have a simulated client that sends 100 byte...
|
by: philip20060308 |
last post by:
Hi all,
Has anyone ever seen Python 2.4.1's httplib choke when reading chunked
content? I'm using it via urrlib2, and I ran into a particular...
|
by: Sean |
last post by:
I am trying to read a cookie I set but I am not sure if I really set
it correctly or I am not reading it correctly. I was given the
following...
|
by: atyndall |
last post by:
Basically,
I have a email script which (on the sending of the email) writes into a file handle called $fcf (on a new line) with the senders ip...
|
by: bleachie |
last post by:
Hey,
I just need some help, my form seems to not send me all of the 'guestNames' and 'guestEmails' forms.
i use this function to add more...
|
by: tammygombez |
last post by:
Hey fellow JavaFX developers,
I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
|
by: tammygombez |
last post by:
Hey everyone!
I've been researching gaming laptops lately, and I must say, they can get pretty expensive. However, I've come across some great...
|
by: concettolabs |
last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
|
by: better678 |
last post by:
Question:
Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct?
Answer:
Java is an object-oriented...
|
by: CD Tom |
last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
|
by: CD Tom |
last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
| |