The following is the documentation for my SMTP replacement library based on CUrl and GMIME, for details, please see the corresponding Blog post.
CUrlSmtp_AddHeader
dummy:=CUrlSmtp_AddHeader( SmtpObject;headerName;headerText{;handleOption})
adds a header to the message object in the smtp object options determine how to handle existing content
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$2 | Text | required | the header key |
$3 | Text | required | the header value |
$4 | Longint | optional | how to handle existing content 0 = just add the header (default) 1 = replace all existing with this one 2 = delete all corresponding headers |
$0 | Longint | always 0 |
CUrlSmtp_Attachment
Error:=CUrlSmtp_Attachment(SmtpObject;filename;encode_type{;handleOption{;attachmentID}})
adds an attachment, replaces attachments or removes them
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$2 | Text | required | the file path or file name, keep empty if you want |
$3 | Longint | required | was used for encoding options. obsolete, we do all in base64 |
$4 | Longint | optional | how to handle existing content 0 = Add (default) 1 = Replace 2 = Remove |
$5 | Text | optional | the id of the attachment, only used if the attachment is inline of an html mail |
$0 | Longint | Error code |
CUrlSmtp_Auth
dummy:=CUrlSmtp_Auth(SmtpObject;username;password{;AuthOption})
prepares the authentication by setting username and password
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$2 | Text | required | the username |
$3 | Text | required | the password |
$4 | Longint | optional | was used for auth options, obsolete as cUrl handles all that |
$0 | Longint | always 0 |
CUrlSmtp_Bcc
dummy:=CUrlSmtp_Bcc(SmtpObject;Address{;Handling})
adds a new “bcc” address to the smtp object
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$2 | Text | required | email address |
$3 | longint | optional | handling option 0: add (default) 1: replace 2: delete |
$0 | Longint | Error Code |
CUrlSmtp_Body
dummy:=CUrlSmtp_Body(SmtpObject;body{;handleOption})
sets the body of the message, handling options may apply
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$2 | Text | required | the email body |
$3 | Longint | optional | how to handle content 0 = Replace if msgBody not empty (default) 1 = Delete 2 = Append 4 = HTML text - cannot be combined with the other options! |
$0 | Longint | Always 0 |
CUrlSmtp_Cc
dummy:=CUrlSmtp_Cc(SmtpObject;Address{;Handling})
adds a new “cc” address to the smtp object
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$2 | Text | required | email address |
$3 | Longint | optional | handling option 0: add (default) 1: replace 2: delete |
$0 | Longint | Error Code |
CUrlSmtp_CheckSendable
Error:=CUrlSmtp_CheckSendable(SmtpObject)
checks if the minimum requirements for sending a mail are met
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$0 | Boolean | TRUE if can be sent |
CUrlSmtp_Clear
dummy:=CUrlSmtp_Clear(SmtpObject)
just a call to a clear variable
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$0 | Longint | Always 0 |
CUrlSmtp_Date
CUrlSmtp_Date(SmtpObject;Date;Time{;timeZone;Offset{;handling}})
sets the message date and time, always in GMT all the fancy time zone and offset options are totally ignored, can’t see the point of these…
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$2 | date | required | the message date |
$3 | time | required | the message time |
$4 | longint | optional | timezone - ignored |
$5 | longint | optional | offset - ignored |
$6 | longint | optional | how to handle existing content 0 = add or replace 1 = Delete |
$0 | Longint | Error code |
CUrlSmtp_Debug
CUrlSmtp_Debug(SmtpObject;Debug{;ShowDebugMessage{;ShowHeaderMessage}})
sets the desired debug options
the second and third option only take effect if the first one is set
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$2 | Boolean | required | debug communication |
$3 | Boolean | optional | show the communication in a message box |
$4 | Boolean | optional | show the header in a message box |
CUrlSmtp_From
Dummy:=CUrlSmtp_From(SmtpObject;Address{;Handling})
adds the FROM address to the smtp object
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$2 | Text | required | email address |
$3 | Longint | optional | handling option 0: add (default) 1: replace 2: delete |
$0 | Longint | Error Code |
CUrlSmtp_GetDebugInfo
info:=CUrlSmtp_GetDebugInfo(SmtpObject;what)
returns the requested error info from the SMTP object
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$2 | Text | required | The error info desired. Valid options are: result - the result number of the cUrl call header - the header of the call debug - the full transcript of the cUrl call curlinfo - the info after the call (json) lasterror - the last error errorstack - the list of all errors encountered |
$0 | Text | The requested information |
CUrlSmtp_Host
Error:=CUrlSmtp_Host(SmtpObject;Host{;Port})
sets the host for the email
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$2 | Text | required | the host address, can contain a port number: host:port |
$3 | Longint | optional | a port number if required |
$0 | Longint | Error code |
CUrlSmtp_MakeAddress
Address:=CUrlSmtp_MakeAddress(Address{;Name})
creates an address object from the email address and optional name passed
will parse a fully encoded email address : fristname lastname <email@addr.ess>
Parameters | |||
---|---|---|---|
$1 | Text | required | the address, either only mail or fully encoded : fristname lastname |
$2 | Text | required | the name if not in address, careful, never pass both! |
$0 | Object | The Address object to add to the recipient array |
CUrlSmtp_New
SmtpObject:=CUrlSmtp_New
creates and initialises a fresh Smtp object
Parameters | |||
---|---|---|---|
$1 | Pointer | required | pointer to an empty c_object |
$0 | Longint | Always 0 |
CUrlSmtp_QuickSend
Error:=CUrlSmtp_QuickSend( hostName ; msgFrom ; msgTo ; subject ; message {; sessionParam}{; port}{; userName ; password} )
will send a mail with the parameters provided
Parameters | |||
---|---|---|---|
$1 | Text | required | Host name or IP address |
$2 | Text | required | From : MailAddress or AddressList |
$3 | Text | required | To : MailAddress or AddressList |
$4 | Text | required | Subject of message |
$5 | Text | required | Message |
$6 | Longint | optional | session Parameter - ignored |
$7 | Longint | optional | Number of port to use |
$8 | Text | optional | User name for authentication |
$9 | Text | optional | Password for authentication |
$0 | Longint | Error Code |
CUrlSmtp_References
Error:=CUrlSmtp_References(SmtpObject;Reference{;handling})
sets the reference header for a message
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$2 | Text | required | the reference |
$3 | Longint | required | how to handle existing content 0 = Add or Replace if value not empty (default) 1 = Add or Replace, delete if value empty 2 = Delete |
$0 | Longint | Error code |
CUrlSmtp_Send
Error:=CUrlSmtp_Send(SmtpObject{;SSLOption})
sends the mail and returns either an error or 0
additional information can be read from the SmtpObject after sending
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$2 | Longint | required | SSL Option - only 2 (no SSL) is actually respected as cUrl handles all the other stuff 0 or omitted=Do not use SSL but switchover allowed 1=Use SSL 2=Never use SSL(switchover |
$0 | Longint | Error code |
CUrlSmtp_Source
Mime:=CUrlSmtp_Source(SmtpObject)
parses the SmtpObject and creates a blob with the MIME message, complete with headers and all included files
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$0 | Blob | A Blob with the full Email Source in UTF-8 |
CUrlSmtp_Subject
dummy:=CUrlSmtp_Subject(SmtpObject;Subject{;option})
sets or modifies the subject
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$2 | Text | required | the subject |
$3 | Longint | required | how to handle existing content 0 = Replace if subject not empty (default) 1 = Replace 2 = Delete |
$0 | Longint | Error code |
CUrlSmtp_To
dummy:=CUrlSmtp_To(SmtpObject;Address{;Handling})
adds or modifies a “to” address to the smtp object
Parameters | |||
---|---|---|---|
$1 | Object | required | The SMTP Object |
$2 | Text | required | the address, either only mail or fully encoded : fristname lastname |
$3 | Longint | optional | handling option 0: add (default) 1: replace 2: delete |
$0 | Longint | Error Code |