Link to home
Start Free TrialLog in
Avatar of Azerthur
Azerthur

asked on

Send an email

I'm giving 50 pts for a fully working code doing the following things :
-send a mail to
     adress  : string                   with an object
     subject : string                    from the adress ( optionnal )
     origin    : string                    saying
     Memo1.lines.text

I need it to do it automatically without the user having to give any confirmation, it can use directly an smtp or just use the default maiiling program
     
   
Avatar of d4jaj1
d4jaj1

use the SMTP component (if you are using at least teh Professional version of D4+).  The component contains ALL of the items you mentioned.  In fact, you wold even have to convert any of teh items, so:

NNsmtp.body := memo1.lines;

will work just fine.  There's also a demo of this compoent in teh Delphi demos directory.  Let me know if you need additional help.

Jay

PS, if you want code examples, you may need to add some more points.
d4jaj1 ,

>>PS, if you want code examples, you may need to add some more points.

thats not how e.e works.
if you propose your comment as the answer then if you can you should at least provide a quick demo,
what would it take ..2 minutes ..mm.
if you want a nice demo of using mapi see here:

http://www.bhnet.com.br/~simonet/archive/mapimail.zip
inthe,

that is howe this how this works, and i've been here a lot longer than you.  The 'customer' has a right to accept or reject any answer they choose - try not to think for them.  Also, my answer is my proposed answer - definitely don't attempt to thionk for me!
Avatar of Azerthur

ASKER

Adjusted points from 50 to 60
Delphi 3 standard, sorry no smtp component, maybe if you send the component....
The file offerered by inthe seems nice but unfortunately it doesn't work, I get a
A mapi compliant messaging application cannot be found in the system
thionk
d4jaj1 :
>> i've been here a lot longer than you
that's a point, but :
d4jaj1 : 19941 points
vs
inthe : 298744 points
is a much better point for me.

What you state as an answer could only rejected.

The only answers that should be directly submitted as answers should come with the code.
We should answer a question only if we are sure it will be accepted as is...
The other times we should only comment questions. If the 'customer' likes your comment he will invite you to answer the question.

To compare the 'customer' satisfaction of you two :
Last 10 Grade(s) Received by d4jaj1 :  
B C B C C C C C C A
and
Last 10 Grade(s) Received by inthe:  
A A A A A A A A B B

sounds like your technic, d4jaj1, is not
the best.

And no, I don't know Inthe personnaly, and yes I know that he does not need me to argue against you.
It's just that I do not agree with your ee vision...

Regards.
John.
I agree.  InThe has always given full and comprehensive answers, where required.  Also, I think it is rude to say "Well you give me more points and I'll do this for you."  I think that's a little playground-like really.

Nicely said John.  You the man.
Another point - what is the point of ever posting an answer?????

Comments can be accepted as answers, so why even have the option of submitting an answer?
Experts, please, lets get back on topic and cut the customer some slack, this is only his/her second question :)

Azerthur I think inthe actually gave you the tool for this in his answer to your question about FTP.

darinw
Customer Service
I know, I went again to ICS but it still doesn't work !!!!!

;-(

Seems like I need a Tsmtpcli that is not included
Azerthur,
Try these components. Thier documentations claims it will work with D3 Pro and greater. So it might not work with Standard, but it is worth a try.

http://sak.org.ar/html/sakemail.html
There is a TEmail freware component that I use for doing something like that

You just drop this component in a form and with a functions like these you can send the email getting MAPI service.


TDModEmail Form :
------------------

..
..
..
type
  Email1: TEmail;

..
..
..


procedure TDModEmail.DModEmailCreate(Sender: TObject);
begin
     MailLogon;
end;


function TDModEMail.MailLogon: boolean;
begin
  if (Email1.Logon <> EMAIL_OK) then
  begin
    Result := False;
    ErrorMsg('MAPI can't connected.');
  end
  else
    Result := True;
end;

function TDModEMail.SendMail(ListRecept,ListCC,ListMsg,ListAttach:TStrings;
       sSubject :String): Boolean;
var
   I,Size : integer;
   P: Pchar;
   sMsg :string;
begin
     If (ListRecept.Count = 0) and (ListCC.Count = 0) Then
        Begin
             Result := False;
             Exit;
        End;
     If Not MailLogon Then
        Begin
             Result := False;
             Exit;
        End;
     sMsg := '';
     For I:= 0 To ListMsg.Count-1 do
     Begin
          sMsg := sMsg + ListMsg.Strings[I] + Chr(13);
     End;
     Email1.Recipient := ListRecept;
     Email1.CC := ListCC;
     Email1.Attachment := ListAttach;
     Email1.SetLongText(PChar(sMsg));
     Email1.Subject := sSubject;
     if (Email1.SendMail <> EMAIL_OK) then
        ErrorMsg('MAPI its not available')
        else
            Result := True;
end;

Check for this component.. there is in some web recources. If you want, I can send it to you.

Hope This Helps!
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial