Solved

Sending email or ftping from VB.NET windows SERVICE app

Posted on 2004-09-24
8
218 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Enroll in July's Course of the Month

July's Course of the Month is now available! Enroll to learn HTML5 and prepare for certification. It's free for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

621 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