Solved

Sending email or ftping from VB.NET windows SERVICE app

Posted on 2004-09-24
8
209 Views
Last Modified: 2010-04-23
I have a VB.NET app that runs as a windows service.  I would like to incorporate some kind of error notification into it in case there is an exception.  I would like to either send an email directly from the application or FTP a file containing the error message to a directory on a server.

Because this application is a Windows service and runs when the machine is logged off I think there will be some difficulty sending an email using an outlook interface (no profile is loaded)

And actually, FTPing a file is preferable in this situation.  Does anyone have any code that is capable of FTPing a file to a location given a server, user ID password, file to load and location?

Thanks
0
Comment
Question by:aflat362
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 10

Expert Comment

by:prakash_prk
ID: 12143261
0
 
LVL 10

Expert Comment

by:prakash_prk
ID: 12143308

You have two options to download and upload files

1.Microsoft internet transfer control
2.Microsoft winsock control

http://www.dart.com/downloads/

regards
prakash
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12144169
You do not need system to be running and outlook to be open to send the mail

service can send mail as well as you will be using System.Web.Mail
http://www.codeproject.com/vb/net/SendMail.asp
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12144203
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 4

Accepted Solution

by:
eozz_2000 earned 250 total points
ID: 12167136
First, make a file with all your commands for FTP, like this and save like C:\CommandFile.dat:

open
myServer
user_name
password
put
file_to_upload
local_file_path
bye

And then, use the following command from .NET:

Shell( "ftp -s:C:\CommandFile.dat", AppWinStyle.Hide, False)
0
 
LVL 3

Author Comment

by:aflat362
ID: 12172125
Duh.  Why FTP with .NET when I don't have to.  A simple FTP script will work just as well.

I can't believe I didn't think of that.

I'm not even going to launch it from my .NET app.  I'll just have an external script kick off every 15 minutes or so.

Thanks much
0
 
LVL 4

Expert Comment

by:eozz_2000
ID: 12176436
Is great to know that this post could help you :)
0
 
LVL 18

Expert Comment

by:armoghan
ID: 12176519
Good answer :)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now