Solved

Sending email or ftping from VB.NET windows SERVICE app

Posted on 2004-09-24
8
213 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 18

Expert Comment

by:armoghan
ID: 12144203
0
 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

813 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

13 Experts available now in Live!

Get 1:1 Help Now