virtual /* [propput] */ HRESULT __stdcall put_Kludges( /* [in] */ BSTR bstrKludges);
This method is optional for calling. It adds the lines with technical information (kludges) to message headline. Each line must end with CRLF sequence (line feed, characters with 13 and 10 codes).
Examples:
X-Mailer: MyApplication
X-Mailer-Version: 1.0
The returned value is S_OK. If memory is not enough to store transmitted value, the returned code will be E_FAIL.
virtual /* [propput] */ HRESULT __stdcall put_From( /* [in] */ BSTR bstrEmail);
Setting the address of message sender. You can specify address in any known format, e.g.:
support@elcomsoft.com
Support <support@elcomsoft.com>
“Alex Gorlach” <gorlach@mailutilities.com>
The returned value is S_OK. If memory is not enough to store transmitted value, the returned code will be E_FAIL. This function doesn't check the address syntax. The Send method checks the correctness of specified values (see below).
virtual /* [propput] */ HRESULT __stdcall put_To( /* [in] */ BSTR bstrEmail);
Setting the address of message recipient. You can specify address in any known format, e.g.:
support@soft.com
Support <support@soft.com>
“Alex Gorlach” <gorlach@mail.com>
The returned value is S_OK. If memory is not enough to store transmitted value, the returned code will be E_FAIL. This function doesn't check the address syntax. The Send method checks the correctness of specified values (see below). You can specify only one address of recipient. If you want to send message to several recipients, it’s necessary to specify recipient and call Send the respective number of times.
virtual /* [propput] */ HRESULT __stdcall put_Subject( /* [in] */ BSTR bstrSubject);
This method is optional for calling. Setting of message “Subject” field. Note, that this string will be placed into the message as is. You must make message encoding yourself, if it is required. The returned value is S_OK. If memory is not enough to store transmitted value, the returned code will be E_FAIL.
virtual /* [propput] */ HRESULT __stdcall put_Body( /* [in] */ BSTR bstrBody);
This method is optional for calling. Setting the message body. Note, that this string will be placed into the message as is. You must make message encoding yourself, if it is required. The message size is not limited. The returned value is S_OK. If memory is not enough to store transmitted value, the returned code will be E_FAIL.
virtual HRESULT __stdcall Reset( void);
This method is optional for calling. Reset all values that are assigned by functions mentioned above. The returned value is S_OK.
virtual HRESULT __stdcall Send( void);
Sending the message. Before call this method, assign message “To“ and “From” fields, the rest fields may be null. The sending doesn’t cause a reset of assigned values (for that there is the Reset() method). Two successive Send() call will send two identical copies of message (only with different values in “Date” field). If you wish to delivery message by list of addresses, then you must fill all message fields once, and then call pairs put_To() – Send() for each recipient.
Returned values:
S_OK – message was successfully sent;
S_FALSE – some error happen.
In second case, you may call get_LastError() method to know the reason of failure (see below).
virtual /* [propget] */ HRESULT __stdcall get_LastError(/* [retval][out] */ long __RPC_FAR *lCode);
This method is optional for calling. Store result code of the last Send() method call into the given variable. The possible values are:
CAE_NO_ERROR (code is 0) – there were no Send() calls, or message was successfully sent during the last call;
CAE_INAVLID_SENDER (1) – wrong email of message sender, or sender email was not set before Send() method call;
CAE_INAVLID_RECIPIENT (2) – wrong email of message recipient, or recipient email was not set before Send() method call;
CAE_FILE_ERROR (3) – error happen during saving message on disk by ADR (information about such errors also stored into ADR error log);
CAE_NO_MEMORY (4) – not enough memory during message sending.
Number of error codes may be increased in future ADR versions. All codes larger than CAE_NO_MEMORY (lCode = 4) must be processed by application as “unknown error”. Returned value is S_OK.