Page 1 of 1

SmtpConnection - additional header fields

Posted: Tue Oct 20, 2009 3:53 pm
by tlcab1
Are there any existing methods to add X-Field or MESSAGE-ID to the messageHeader of the SmtpConnection class. I have looked into "buildMessageHeader" method on this class and this is what I am after and I have got it working within this method, however if I updated CardSchema I would obviously lose this. Does anyone know of an easy way to implement this?

E.g.
x_part := "Message-ID:" & Space & LeftAngle & "000e0cd2538cag0f6104764609e4@DOMAIN.com" & RightAngle;
smtp.mAddToMessageHeader(x_part); //add the extra field to the header

Re: SmtpConnection - additional header fields

Posted: Tue Oct 20, 2009 7:26 pm
by alanvl
You could sub class the CnSmtpConnection class within you own schema then re-implement the buildMessageHeader method - adding your code changes.

You would then create an instance of your subclass of CnSmtpConnection but continue using it as you would have used the CnSmtpConnection instance you worked with previously - e.g. Assuming your subclass is called MySmtpConnection ...

vars
connection:CnSmtpConnection;
...
begin
...
create connection as MySmtpConnection transient;
...
connection.buildMessageHeader();
...

Re: SmtpConnection - additional header fields

Posted: Wed Oct 21, 2009 10:00 am
by tlcab1
Thanks for your response. This is what I expected and had already done. The problem doing it this way would be if the buildMessageHeader method changes in CardSchema I would need to re-implement the changes or end up with methods in error (not to hard to deal with though). I also end up with not being able to override the method and pass in additional parameters (i.e. the Message-ID). It would be far nicer having the SmptConnection class supporting this.

Re: SmtpConnection - additional header fields

Posted: Wed Oct 21, 2009 10:50 am
by BeeJay
You could try submitting an NFS request to the JADECare Start developers to have a published means of adding additional header elements put into CardSchema.

Cheers,
BeeJay.