Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

email functionality in Delphi app

Posted on 1999-06-30
19
Medium Priority
?
217 Views
Last Modified: 2010-04-06
I've found many examples of how to send email from within a Delphi app, but when I try them something goes wrong with the formatting.

First of all, the body of the mail I want to send contains single and double quotes, so I cannot use

Buffer:='mailto:'+recip+'?subject='+subj+'&body='+mess;
ShellExecute(Application.Handle,'open',PChar(Buffer),nil,nil,SW_Normal);

Second, when I specify the body of the mail to be the text in a memo, and I've entered some spaces, tabs and hard returns in this memo, my email client ignores these.
This is unacceptable because the format of the email has to be generated and sent exactly as specified.

Can someone show me a good way to do the following:

1.  open an email client
2.  assign a lot of text to its body, including returns, quotes, ...
3.  send it automatically

Thank you
0
Comment
Question by:belgianbasman
[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
  • 8
  • 6
  • 4
  • +1
19 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 1385465
Try this component:

http://www.rtfm.be/fpiette/smtpcliuk.htm

A demo is included
0
 
LVL 17

Expert Comment

by:inthe
ID: 1385466
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1385467
Btw: what do you mean by 'send it automatically'?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:belgianbasman
ID: 1385468
for 200 points, I'll expect a bit more than just another link to just another component on the net :)
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1385469
But what do you want then??? It a complete app.
0
 

Author Comment

by:belgianbasman
ID: 1385470
I'll check it out, but I was kinda hoping for a detailed code example without having to wade trough a whole application to find the code I need.

Anyway, put your answer up again and I'll give you the points.
0
 
LVL 6

Accepted Solution

by:
Stuart_Johnson earned 800 total points
ID: 1385471
Hi,

I just wrote you an example using standard Delphi controls.  The demo & source can be downloaded here for you to review.

http://www.nlc.net.au/~enigma/source/sendmail.zip

Best wishes,

Stuart.
0
 

Author Comment

by:belgianbasman
ID: 1385472
Thank you.
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 1385473
No problem at all.  Glad to be of help.

Best wishes,


Stuart.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1385474
Are you nuts or something? What the hell is this? Why did you reject my answer and accept this one. Knowing where to find good stuff is valuable knowledge too.

:o(

0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 1385475
Hay Epsylon.  I didnt realise you had posted an answer - I suppose it pays to read all the comments first.  I saw what belgianbasman asked for and wrote him an example and posted it as an answer because the question was open.  

It was a bit of an insult though to have you say that something I did was inferior to what you proposed.  My little shitty app did exactly what belgianbasman wanted, even if it did look ugly and had virtually no code.  

People dont want their entire application written for them - just a good starting point and enough ideas to get going.  In some cases, too much information can be worse than none at all.

And besides, why download a component when there is components already found within Delphi which do the job with full online help and examples?

Just rushing to my defence :)


Cheers.

Stuart.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1385476
Stuart, no offence to you intended. I didn't say that your app was inferior, but also it is not superior.

Not everyone has the Client/Server version of Delphi so F. Piettes component was a safe choice and it includes a very good example.

And instead of asking details about it, belgianbasman just pushed it aside as if it was 'just another component from the net'. I think this is not the way to treat answers.

Epsylon.
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 1385477
I totally agree with you, but when it all boils down to it, the final decision is belgianbasmans and whether we like it or not, we have to accept that.  I have been burnt countless times proposing answers and having them rejected for no reason and someone else getting the points.  I used to also post answers as comments to allow other people to add to my ideas or to better them.  I dont even bother anymore - even if my suggestion is crap, I'll post it as an answer so I dont miss out.  I know it sounds like point grabbing, but I am only looking afer my interests.  If I spend time on a question, I would like to be recognised for it (as do you).

I did not realise that Borland did not ship Delphi without the NetMaster controls.  I thought they were available in all versions.  The components can still be downloaded from NetMasters web site though for the Standard and Professional versions?

Anyway, again, I appologise for stamping on your ground, but I do think I offered something to belgianbasman which was almost exactly as he wanted - even if you did too.  Its just a shame for you he didnt investigate further.

Best wishes,


Stuart.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1385478
There is nothing wrong with your app, but I bet he did not even LOOK at F. Piettes component.

Btw: I never tested NetMasters Email components but some other like TNMStrm, PowerSock and TNMGeneralServer fail completely. I have spend weeks on them but did not get any of them to work without trouble (deadlocks) and I was doing the most simple things. So don't waste your time on them if you may need them. Just my advice  :o)
This was another reason for me to prefer F. Piettes because I don't trust NetMasters Email components.

Epsylon.
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 1385479
I have used TNMStrm, TNMStrmServ and PowerSock in plenty of applications, so of which are being used all over the world now, without any problems at all.  I have never heard of any problems with these components either.  Strange.  I wonder what could be going wrong.

Stu.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1385480
Calling TNMStrm.PostIt more that once often hangs the application. I am not the only one having trouble.
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 1385481
Have you upgraded your version of the NM controls?  I had a few problems with the ones which were shipped with DElphi, but afer upgrading them, I have had no problems what-so-ever.

Cheers,

Stuart.
0
 

Author Comment

by:belgianbasman
ID: 1385482
Hey Epsilon and Stuart,

it looks like the discussion is out of my hands now. :-)
Epsilon,  I did look at F.Piettes components, but that was even before I posted this question.  I found references to it in at least a dozen questions and answers here at experts-exchange.

So I tought that I should give the points to someone who took the time to write a bit of sample code himself instead of to someone who could have just copied a reference from a previous question.

Like it or not, but that's the way it is.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 1385483
Stuart, I did not upgrade them.

Belgianbasman, I still don't know what's wrong with F.Piettes.....

Or is the only reason that you rejected it that my answer was to easy.


0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

715 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