473,387 Members | 1,517 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Console App Email

I need a console application to send me an e-mail....in
the past I have use SQL Server's mail messaging to send my
e-mails for console applications, but often the SQL Server
mail message will not get sent because the SQL Server
times out....In my web pages I use the Web MailMessage
object, and it does very well....Can I use the Web
MailMessage object in a console application, if so how do
I set it up, if not what options are there other than SQL
Server's mail messaging?

Thanks,
Adam
Nov 16 '05 #1
17 1744
Adam <an*******@discussions.microsoft.com> wrote:
I need a console application to send me an e-mail....in
the past I have use SQL Server's mail messaging to send my
e-mails for console applications, but often the SQL Server
mail message will not get sent because the SQL Server
times out....In my web pages I use the Web MailMessage
object, and it does very well....Can I use the Web
MailMessage object in a console application, if so how do
I set it up, if not what options are there other than SQL
Server's mail messaging?


Yes, you can use MailMessage in a console app - but because it uses
CDO, there are a few restrictions about platforms it will run on.

You could always use Indy: http://www.indyproject.org

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 16 '05 #2
Jon Skeet [C# MVP] <sk***@pobox.com> wrote in
news:MP************************@msnews.microsoft.c om:
You could always use Indy: http://www.indyproject.org


There is a C# SMTP demo of Indy here as well:
http://www.atozed.com/indy/
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
Nov 16 '05 #3
There are also tons of native smtp client examples on sites like
csharp-corner, etc. The Indy is good, but required the library which may be
overkill for your distribution.

--
William Stacey, MVP

"Adam" <an*******@discussions.microsoft.com> wrote in message
news:f2****************************@phx.gbl...
I need a console application to send me an e-mail....in
the past I have use SQL Server's mail messaging to send my
e-mails for console applications, but often the SQL Server
mail message will not get sent because the SQL Server
times out....In my web pages I use the Web MailMessage
object, and it does very well....Can I use the Web
MailMessage object in a console application, if so how do
I set it up, if not what options are there other than SQL
Server's mail messaging?

Thanks,
Adam


Nov 16 '05 #4
"William Stacey [MVP]" <st***********@mvps.org> wrote in
news:OK**************@TK2MSFTNGP09.phx.gbl:
There are also tons of native smtp client examples on sites like
csharp-corner, etc. The Indy is good, but required the library which


All of these implement only the basics and users will quickly be in trouble
as these "snippets" only implement the base of the protocol. They wont work
wtih all servers because of auth, ESTMP, EHLO, MIME and other reasons. I
would cosnider such snippets of academic use only and not safe for
production.

I understand your point of view, but its a bit like telling a developer not
to use C# because its overkill, but rather use one of the academic languages
for .NET like those found on MSDN.

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Develop ASP.NET applications easier and in less time:
http://www.atozed.com/IntraWeb/
Nov 16 '05 #5
> I understand your point of view, but its a bit like telling a developer
not
to use C# because its overkill, but rather use one of the academic languages for .NET like those found on MSDN.


Maybe. The snippets also get you to learn a little bit and build your own
classes, which is focus of ng (IMO.) We can and do point people to dll
Libraries as needed, but we could do that for almost every question - that
is a lot of Dlls in your application. Sometimes folks just want to see some
code and as Indy is delphi and this is a c# ng, you can't really look at c#
code (correct if wrong.) That said, I recommend your good library all the
time when someone asks for a library or if I ~think they are really needing
a library as apposed to some good old sample code. Anyway, all is good.
Cheers!

--
William Stacey, MVP
Nov 16 '05 #6
"William Stacey [MVP]" <st***********@mvps.org> wrote in
news:ut**************@TK2MSFTNGP11.phx.gbl:
Maybe. The snippets also get you to learn a little bit and build your
own classes, which is focus of ng (IMO.) We can and do point people to
Yes, I agree if its for a learning or academic use. Snippets are much better
in that case.
to see some code and as Indy is delphi and this is a c# ng, you can't
really look at c# code (correct if wrong.) That said, I recommend your
But there is tons of code in C# using Indy. The FCL is is a lot of C++, and
C# but that doesnt stop VB developers from using it. Thats the beauty of .NET
- language is irrelevant.
good library all the time when someone asks for a library or if I ~think
they are really needing a library as apposed to some good old sample


Thanks. But its not my library. :)

Indy has a team of 45 core developers on it - Im just the active one in the
..NET groups.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/
Nov 16 '05 #7
> But there is tons of code in C# using Indy. The FCL is is a lot of C++,
and

"using Indy" is key, the library itself is c++ or delphi, not c# -
right/wrong?

--
wjs

Nov 16 '05 #8
"Chad Z. Hower aka Kudzu" <cp**@hower.org> wrote in
news:Xn******************@127.0.0.1:
to see some code and as Indy is delphi and this is a c# ng, you can't
really look at c# code (correct if wrong.) That said, I recommend your


BTW - C# code. :)

http://www.codeproject.com/useritems/IndySMTP.asp
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
Nov 16 '05 #9
"William Stacey [MVP]" <st***********@mvps.org> wrote in news:
#C**************@TK2MSFTNGP12.phx.gbl:
"using Indy" is key, the library itself is c++ or delphi, not c# -
right/wrong?


Its Delphi - but that doesnt matter. .NET assemblies are .NET assemblies. A
C# or VB or Delphi programmer no longer cares what the assembly is written
in.

Do you care what the FCL is in? Or a commerical assembly? No - its .NET and
works in any .NET language, C#, VB or Delphi.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/
Nov 16 '05 #10
"William Stacey [MVP]" <st***********@mvps.org> wrote in news:
#C**************@TK2MSFTNGP12.phx.gbl:
"using Indy" is key, the library itself is c++ or delphi, not c# -


BTW - in case you are not aware - Delphi is a .NET language now too. Its not
an unmanaged library with a COM interface on top. Its IL.
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Develop ASP.NET applications easier and in less time:
http://www.atozed.com/IntraWeb/
Nov 16 '05 #11
Quicksoft has a 60K "FreeSMTP.net" class library that I have found to be
quite reliable:
http://www.quiksoft.com/freesmtp/

--Peter
"Adam" <an*******@discussions.microsoft.com> wrote in message
news:f2****************************@phx.gbl...
I need a console application to send me an e-mail....in
the past I have use SQL Server's mail messaging to send my
e-mails for console applications, but often the SQL Server
mail message will not get sent because the SQL Server
times out....In my web pages I use the Web MailMessage
object, and it does very well....Can I use the Web
MailMessage object in a console application, if so how do
I set it up, if not what options are there other than SQL
Server's mail messaging?

Thanks,
Adam

Nov 16 '05 #12
> BTW - in case you are not aware - Delphi is a .NET language now too. Its
not
an unmanaged library with a COM interface on top. Its IL.


Kool. Did not know that. Will need to check it out.

Nov 16 '05 #13
> Its Delphi - but that doesnt matter. .NET assemblies are .NET assemblies.

Thanks for clearing that up Chad ;) We both understand this. That was not
the point. The point was I could not open the assembly and look at the code
without Delphi knowlege or Dephi .Net as you said in other post. We both
agree it is good lib. This is probably now OT so I punt. Cheers.

--
William Stacey, MVP
Nov 16 '05 #14
"Peter Bromberg [C# MVP]" <pb*******@yahoo.com> wrote in
news:OW**************@TK2MSFTNGP09.phx.gbl:
http://www.quiksoft.com/freesmtp/


This one is fully featured, but the free one is missing several key elements
that most users will need like authentication.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/
Nov 16 '05 #15
"William Stacey [MVP]" <st***********@mvps.org> wrote in
news:Oy*************@TK2MSFTNGP12.phx.gbl:
Thanks for clearing that up Chad ;) We both understand this. That was
not the point. The point was I could not open the assembly and look at
the code without Delphi knowlege or Dephi .Net as you said in other


Yes you can. Open it in reflector and you can see it as C#, VB, or Delpi.
Reflector even has a Delphi plugin now....

But then again it goes back to does the user want to USE a library, or look
at code acadmically?
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Get your ASP.NET in gear with IntraWeb!
http://www.atozed.com/IntraWeb/
Nov 16 '05 #16
I have tried the Hower code and get an error at the line

LSMTP.Connect();

The error is "incorrect domain name"
I have checked all the domain names, and there is nothing wrong with them.
Any suggestions?

Patrick.

"Chad Z. Hower aka Kudzu" <cp**@hower.org> wrote in message
news:Xn******************@127.0.0.1...
"Peter Bromberg [C# MVP]" <pb*******@yahoo.com> wrote in
news:OW**************@TK2MSFTNGP09.phx.gbl:
http://www.quiksoft.com/freesmtp/
This one is fully featured, but the free one is missing several key

elements that most users will need like authentication.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/

Nov 16 '05 #17
These are the error messages I get.
Any suggestions how to get this thing working properly?
Many thanks,
Patrick.

t Indy.Sockets.IndyReplySMTP.ReplySMTP.RaiseReplyErr or()
at
Indy.Sockets.IndyTCPConnection.TCPConnection.Raise ExceptionForLastCmdResult(
)
at Indy.Sockets.IndyTCPConnection.TCPConnection.Check Response(Int16
AResponse, Int16[] AAllowedResponses)
at Indy.Sockets.IndyTCPConnection.TCPConnection.GetRe sponse(Int16[]
AAllowedResponses)
at Indy.Sockets.IndyTCPConnection.TCPConnection.SendC md(String AOut,
Int16[] AResponse)
at Indy.Sockets.IndyTCPConnection.TCPConnection.SendC md(String AOut,
Int16 AResponse)
at Indy.Sockets.IndySMTPBase.SMTPBase.SendGreeting()
at Indy.Sockets.IndySMTP.SMTP.Connect()
at SendMail.Form1.butnSendMail_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)

"Patrick de Ridder" <wa********@all.here> wrote in message
news:57**************************@freeler.nl...
I have tried the Hower code and get an error at the line

LSMTP.Connect();

The error is "incorrect domain name"
I have checked all the domain names, and there is nothing wrong with them.
Any suggestions?

Patrick.

"Chad Z. Hower aka Kudzu" <cp**@hower.org> wrote in message
news:Xn******************@127.0.0.1...
"Peter Bromberg [C# MVP]" <pb*******@yahoo.com> wrote in
news:OW**************@TK2MSFTNGP09.phx.gbl:
http://www.quiksoft.com/freesmtp/


This one is fully featured, but the free one is missing several key

elements
that most users will need like authentication.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/


Nov 16 '05 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Richard Lionheart | last post by:
Hi All, When I create a Console app in VS.net and run it, the Console window opens briefly and closes. If I was running a .bat command file, I'd append a pause stmt at the end. What can I do...
3
by: - Steve - | last post by:
Okay I call Console.Read() twice. However when I come up on my second Console.Read() ASCII character 10 is already on the console (that's a line feed). How do I clear out that line feed before...
11
by: objectref | last post by:
Hi to all, i have a window app and i want to display some info in a console window. I figured out (after a very long search...) how am i supposed to do it and i try using the following code. ...
1
by: Kevin | last post by:
In a newsgroup thread from Jan 8, 2003 between Barry Holsinger and the VBDotNet Team, please review this excerpt: "You understood my problem completely. Your sample code provides a really...
3
by: Andrew Ducker | last post by:
We were using Console.Writeline from within our app, to do some routine debugging. And then we started having random problems when the code was run by a tester, on their own machine. We...
1
by: Joachim | last post by:
Is there a way to set a timeout for the Console.ReadLine method?
4
by: eduardorp1 | last post by:
I have a GUI application that needs to be invoked from the command line as well. It should work both as a GUI and as a console application. When I invoke it from the command line, it reads all...
3
by: julianmoors | last post by:
Hey, Currently I'm writing a VB.NET/1.1 app and I need to mask the input for the password field. Does anyone know how to do this in VB? I've seen a C# example, but wouldn't know how to convert...
5
by: Hooyoo | last post by:
Hi, here. I write following codes: string password = Console.ReadLine(); I want users enter their passwords, but readline will show content of password when entering, so is there any way to...
10
by: Stephany Young | last post by:
When one uses the System.Diagnostics.Process.Start method to launch a common or garden Console application, one can set the WindowStyle property of the StartInfo object to ProcessWindowStyle.Hidden...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
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,...
0
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...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.