Temporary SMTP Server

G

Guest

I have a program that runs a second program with the following code:

Dim process As New Process()
Dim FileName As String = "externalprog.exe"
Dim Arguments As String

Arguments = "/c"
process.StartInfo.UseShellExecute = False
process.StartInfo.RedirectStandardOutput = True
process.StartInfo.RedirectStandardError = True
process.StartInfo.CreateNoWindow = True
process.StartInfo.FileName = FileName
process.StartInfo.Arguments = Arguments
process.StartInfo.WorkingDirectory = Application.StartupPath
process.Start()
Return process.StandardOutput.ReadToEnd()

The advanatge to running my code like this is I can read the output from the
dos prompt.

The problem is this external program does log any data if the process fails
but it does send an email. I am wondering if there is a way to have my
program that runs this one act as a temporary smtp server and recieve the
email the external program sends and then read the error out of the body of
the email? If possible this would have to work on a server that currently
has a smtp server runing.

Thanks!
 
P

Peter Huang [MSFT]

Hi Joey,

Firstly I would like to understand the scenario.

1. The code your provide is to redirect the output of the externalprog.exe
program.

That is to say, e.g. the externalprog.exe is running in DOS mode(Console),
we can capture the output in the Console.

2. The problem is this external program does log any data if the process
fails
but it does send an email. I am wondering if there is a way to have my
program that runs this one act as a temporary smtp server and recieve the
email the external program sends and then read the error out of the body of
the email? If possible this would have to work on a server that currently
has a smtp server runing.

When fails, the externalprog.exe will send an mail, and you will want to
capture the content.
So how did the externalprog.exe to send an mail?
If the externalprog.exe will connect to certain SMTP server and send an
mail, then we can not capture the mail via redirect output.
As I pointed before, the redirect output function is used to capture the
output. e.g. what we will see in the Console(DOS window).

If I misunderstood, please feel free to let me know.



Best regards,

Peter Huang

Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top