The script should be handled to the OnPrivateMessage event on MyChat Server:
Message sending does not impact the server's speed, so you have nothing to worry about.
Instead of sHost, sLogin, sPassword, and sPort you have to type parameters of your email server.
const
sHost = 'mail.yourserver.com';
sLogin = '[email protected]';
sPassword = 'secretpassword';
iPort = 26;
function OnPrivateMessage(iCID, iUIN, iUINTo, iMsgType: integer; sMsg: string): boolean;
var
sEmailTo, sEmailFrom, sTextBody, sNameFrom, sNameTo: string;
begin
result := true;
if not mIsUINOnline(iUINTo) then begin
sEmailTo := mGetUserPrimaryEmail(iUINTo);
sEmailFrom := mGetUserPrimaryEmail(iUIN);
if (length(sEmailTo) > 0) and (length(sEmailFrom) > 0) then begin
sNameFrom := mGetUserFullNameByPreset(iUIN, 0);
sNameTo := mGetUserFullNameByPreset(iUINTo, 0);
sTextBody := '<span style="color:green">' +
FormatDateTime('[mm.dd.yyyy hh:nn:ss]', Now) +
'</span>' +
' '+
'<span style="color:blue"><b>' +
sNameFrom +
'</b></span>'+
'> '+
ReplaceString(mConvertMsgToPlainText(sMsg, iMsgType), CRLF, '</br>', true, false);
SendEmail(sHost, iPort, sLogin, sPassword, sEmailFrom, false, sEmailTo,
'MyChatoffline message for ' + sNameTo, sTextBody, 1, '');
end;
end;
end;
begin
end.
Share your ideas, if any