Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: idSMTPServer, forward an email as attachment



Permlink Replies: 0
Filippo Forlani

Posts: 17
Registered: 7/23/99
idSMTPServer, forward an email as attachment
Click to report abuse...   Click to reply to this thread Reply
  Posted: Mar 11, 2016 7:22 AM
Hello,
I create a simple SMTP Server with TidSMTPServer.
When Server get an email error it should send the mail recieved as an attachment to a defined address.

My problem is that I don't find the way to attach an email via streams (I mean without saving it as a file).

This is my working procedure:

      msg:=TIdMessage.Create(nil);
        msg.body.add(myText);
        msg.subject:=subject;
        msg.from.text:='smtpserver@address.net';
        msg.from.name:='Smtp Server';
 
        with msg.Recipients.Add  do
          Text := 'errormail@address.net';
 
        amessage.SaveToFile('myfile.eml');
        attachment:=TIdAttachmentFile.Create(msg.messageparts,'myfile.eml');
 
        idsmtp.Send(msg);
  


Now I would send the mail without saving a file, just using streams, i.e. attachment.loadfromstrem(...?)...

I tried different ways but unsuccesfully,
can anyone help me?
thnks in advance,
Filippo

--
______________________
Filippo Forlani
www.filippoforlani.org

Edited by: Filippo Forlani on Mar 11, 2016 4:22 PM
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02