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?...ho w could this be done? 6 2210
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?...ho w 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.Smtp Client class.
A sample code would be:
' Instantiate SmtpClient Class
Dim emailClient As New SmtpClient("smt p.gmail.com")
' Instantiate MailMessage Class
Dim message As New MailMessage("fr om_here", "to_here", "subject_he re",
"body_here" )
message.Attachm ents.Add(New Attachment("att achment_path_he re")
' Credentials here <optional>
' Set credentials using System.Net.Netw orkCredential.. .
' .......
' Send mail
emailClient.Sen d(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\m yfile.txt
and than display the contents of file.txt in an email body
On May 21, 11:44*am, kimiraikkonen <kimiraikkone.. .@gmail.comwrot e:
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?...ho w 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.Smtp Client class.
A sample code would be:
' Instantiate SmtpClient Class
Dim emailClient As New SmtpClient("smt p.gmail.com")
' Instantiate MailMessage Class
Dim message As New MailMessage("fr om_here", "to_here", "subject_he re",
"body_here" )
message.Attachm ents.Add(New Attachment("att achment_path_he re")
' Credentials here <optional>
' Set credentials using System.Net.Netw orkCredential.. .
' .......
' Send mail
emailClient.Sen d(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\m yfile.txt
and than display the contents of file.txt in an email body
On May 21, 11:44*am, kimiraikkonen <kimiraikkone.. .@gmail.comwrot e:
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?...ho w 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.Smtp Client class.
A sample code would be:
' Instantiate SmtpClient Class
Dim emailClient As New SmtpClient("smt p.gmail.com")
' Instantiate MailMessage Class
Dim message As New MailMessage("fr om_here", "to_here", "subject_he re",
"body_here" )
message.Attachm ents.Add(New Attachment("att achment_path_he re")
' Credentials here <optional>
' Set credentials using System.Net.Netw orkCredential.. .
' .......
' Send mail
emailClient.Sen d(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.WebC lient
textbox1.text = myclient.Downlo adString("\\ser ver\docs\myfile .txt")
Now you can set textbox1 as body of your outgoing mail in
MailMessage's constructors:
Dim message As New MailMessage("fr om", "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?...ho w 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******** *************** ***********@k30 g2000hse.google groups.com...
OK...but I dont want to load the file as an attachment.
I want to read, for example \\server\docs\m yfile.txt
and than display the contents of file.txt in an email body
On May 21, 11:44 am, kimiraikkonen <kimiraikkone.. .@gmail.comwrot e:
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?...ho w 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.Smtp Client class.
A sample code would be:
' Instantiate SmtpClient Class
Dim emailClient As New SmtpClient("smt p.gmail.com")
' Instantiate MailMessage Class
Dim message As New MailMessage("fr om_here", "to_here", "subject_he re",
"body_here" )
message.Attachm ents.Add(New Attachment("att achment_path_he re")
' Credentials here <optional>
' Set credentials using System.Net.Netw orkCredential.. .
' .......
' Send mail
emailClient.Sen d(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******** *************** ***********@k30 g2000hse.google groups.com...
OK...but I dont want to load the file as an attachment.
I want to read, for example \\server\docs\m yfile.txt
and than display the contents of file.txt in an email body
On May 21, 11:44 am, kimiraikkonen <kimiraikkone.. .@gmail.comwrot e:
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?...ho w 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.Smtp Client class.
A sample code would be:
' Instantiate SmtpClient Class
Dim emailClient As New SmtpClient("smt p.gmail.com")
' Instantiate MailMessage Class
Dim message As New MailMessage("fr om_here", "to_here", "subject_he re",
"body_here" )
message.Attachm ents.Add(New Attachment("att achment_path_he re")
' Credentials here <optional>
' Set credentials using System.Net.Netw orkCredential.. .
' .......
' Send mail
emailClient.Sen d(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(). I would like to know what are the advantages and
disadvantages of using a MySQL blob field rather than reading the
images directly from the file? How does one insert an image into a
blob field? Can it be done dynamically?
Thank you
John
|
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
when I try to open it saying it is corrupt. Obviuosly, the file is
fine on the server, so the attachment code I am using must be
corrupting it, but I dont know what it is:
// send email with attachment
function emailAttachment($to, $subject, $message, $name, $email,
|
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 (that I
didn't write). Each message from the server is on one line (\r\n at end) and
is formed as - each of
which is seperated by a space. Arguments with spaces in them are enclosed in
quotations.
So, I'm able to open a connection to the server. When I send a message to
|
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");
$content = fread ($handle, filesize($filename));
fclose($handle);
echo ($content);
?>
But in file news.txt I have formating that is not showing, but
interpreting.
|
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 packets.
I have set up the socket server so that its buffer is bigger than this.
I did this expecting the data to be read in one pass.
| |
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 server
that returns something that httplib doesn't expect. Specifically, in
the code below where the error occurs, line == ''.
Python 2.4.1 (#2, Oct 12 2005, 01:36:32)
20050518] on freebsd6
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib2
|
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 instructions to set the cookie. It appears to be working
because in Firefox browser I see the cookie listed for my domain
I have been searching everywhere to find information on reading the
cookie value that I set. I used the following code I found which
returns 'no cookiez' in spite of the...
|
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 address ($ipaddress) and the time on which they sent their email ($time) in this format: $ipaddress--$time on a new line in $fcf.
I am new to php and if someone could convert my normal language into PHP scripting I would be very grateful.
if ($fcf contains $_SERVER with time() ) {
Thanks
|
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 guestnames and guestemail fields based on the number of guests added.
form.php
function createGuestNameAndEmailElements()
{
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |