• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

report by e-mail in delphi 3

how do i send a report by e-mail in Delphi 3?

what are my choices and what do i do?

thanks...
0
marcelomferreira
Asked:
marcelomferreira
  • 4
  • 3
1 Solution
 
PeterLarsenCommented:
Like this :

Use Tnmsmtp.

var
mail : TNMSMTP
begin

mail:=tNMSMTP.create(self); //or just place it on the form
Mail.PostMessage.Subject:='Some text';
Mail.Host:='MailServerName';
Mail.Port:=25;
Mail.UserID:='Your name - not very important';
Mail.PostMessage.FromAddress:='Your mail address';
Mail.PostMessage.FromName:='Your name - not very important';
Mail.PostMessage.ToAddress.Clear;
Mail.PostMessage.ToAddress.Add('E-mail address');
Mail.PostMessage.Attachments.Clear;
Mail.PostMessage.Attachments.Add('a file name');
Mail.PostMessage.Body.Text:='E-mail body - text';
Mail.Connect;
Mail.SendMail;
Mail.Disconnect;

/PL
0
 
rwilson032697Commented:
Listening
0
 
marcelomferreiraAuthor Commented:
Thanks, but I still have a problem...

How can the receiver read my report if it's in .QT format? Isn't there any way to send it inside the e-mail in Body section?
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
PeterLarsenCommented:
Hmm, I dont get it. BODY is a TStringList. You may put almost anything in it.
Give me some details, please.
0
 
marcelomferreiraAuthor Commented:
Suppose I make a clients report, containing Code and Name ,like this:

==================================
      **** MY BUSINESS ****

          CLIENTS REPORT

CODE    NAME
   1    aaaaaaaaaaaaaaaaaaaaaaaaaa
   2    bbbbbbbbbbbbbbbbbbbbbbbbbb
   3    cccccccccccccccccccccccccc
==================================

To see this report I use:

rptClients.Preview;

but I want to print this report and send this in an e-mail, like this:

--------------------------------------
FROM: xxx@xxxxx.xxx
TO: zzz@zzz.zzz
SUBJECT: vvvvvvvvvvvvv
BODY:
==================================
      **** MY BUSINESS ****

          CLIENTS REPORT

CODE    NAME
   1    aaaaaaaaaaaaaaaaaaaaaaaaaa
   2    bbbbbbbbbbbbbbbbbbbbbbbbbb
   3    cccccccccccccccccccccccccc
==================================
--------------------------------------

The answer you gave me tells me to attach a file in my e-mail, ok? but I wish I could avoid attaching anything on it. It'd better if I send it directly in the body section.

Is there any way?
0
 
PeterLarsenCommented:
I dont see any problem by include that text in the body.

Just use the body property. If you dont know how to add strings in the body, take a look at TStringList in the helpfile.

var
 s : string;
begin
s:='==========================='+chr(10)+chr(13);
s:=s+'              **** MY BUSINESS ****';
Mail.PostMessage.Body.Text:=s;

or

Mail.PostMessage.Body.Clear;
Mail.PostMessage.Body.add('===========================');
Mail.PostMessage.Body.add('              **** MY BUSINESS ****');
0
 
marcelomferreiraAuthor Commented:
Ok. This text was an example. What about I have a very big report generated by Delphi containing 10 pages of clients data and this report is in the screen (viewed by command Preview).

How do I transfer everything from the report to the body section when I don't know what may be in the report preview?
0
 
PeterLarsenCommented:
I guess that this report is loaded from a file. If that's so, you can simply load it directly in to the body - like this : Mail.PostMessage.Body.LoadFromFile('filename');

If this wont do it, you have to give me some more information - like which application do you use to produce this report and what choice does this program gives you - is it possible to save it somehow ??
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now