SmtpConnection - additional header fields

Forums for specific tips, techniques and example code
tlcab1
Posts: 2
Joined: Mon Aug 17, 2009 9:12 am

SmtpConnection - additional header fields

Postby tlcab1 » Tue Oct 20, 2009 3:53 pm

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

alanvl
Posts: 29
Joined: Fri Aug 14, 2009 9:16 pm

Re: SmtpConnection - additional header fields

Postby alanvl » Tue Oct 20, 2009 7:26 pm

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();
...

tlcab1
Posts: 2
Joined: Mon Aug 17, 2009 9:12 am

Re: SmtpConnection - additional header fields

Postby tlcab1 » Wed Oct 21, 2009 10:00 am

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.

User avatar
BeeJay
Posts: 312
Joined: Tue Jun 30, 2009 2:42 pm
Location: Christchurch, NZ

Re: SmtpConnection - additional header fields

Postby BeeJay » Wed Oct 21, 2009 10:50 am

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.


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 13 guests

cron