Using cnSMTPConnection to send an email
Posted: Fri Mar 16, 2012 11:13 pm
Hi all,
In our system we use the cnSMTPConnection class in a number of places to send "automatic" emails when something occurs. This has always worked sufficiently for the emails that we send, however, we now have a requirement to send an email where the message length is greater than 1000 characters, and it turns out that this is a problem...
The error i am getting is "100007 Undefined message number - CnSmtpConnection::validateASCIIMessage One of the message lines exceeds 1000 characters". I can't find any documentation on this class (though i am sure it must be somewhere) so i'm unsure as to how to force the email to be spread over more than one message line.
Has anybody else used this method to send an email of greater length? Or, is there a better way for me to achieve this. The email sending should need no manual intervention at all.
The bare-bones code i'm using for this is:
Any help would be greatly appreciated.
Rich
In our system we use the cnSMTPConnection class in a number of places to send "automatic" emails when something occurs. This has always worked sufficiently for the emails that we send, however, we now have a requirement to send an email where the message length is greater than 1000 characters, and it turns out that this is a problem...
The error i am getting is "100007 Undefined message number - CnSmtpConnection::validateASCIIMessage One of the message lines exceeds 1000 characters". I can't find any documentation on this class (though i am sure it must be somewhere) so i'm unsure as to how to force the email to be spread over more than one message line.
Has anybody else used this method to send an email of greater length? Or, is there a better way for me to achieve this. The email sending should need no manual intervention at all.
The bare-bones code i'm using for this is:
Code: Select all
vars
conn : CnSmtpConnection;
begin
app.cnActivateKarmaControl(Cn_Fat_Client, null, null);
create conn;
self.beginNotification(conn, CnSmtpConnection.Completion_Event_Type, Response_Cancel, 0);
conn.name := exchange server name;
conn.sendFrom := emailFrom;
conn.contentType := "html";
conn.sendTo := emailTo;
conn.subject := "My email";
conn.message := Message needs to be > 1000 chars long
conn.send;
while not conn.completed do
app.doWindowEvents(10);
endwhile;
epilog
delete conn;
end;
Rich