If you like to review the email in source code, you can use the GetSource function and
display the email in a text field:
!"
Set Field [EMail::EmailSource; MBS( "String.ReplaceNewline";
MBS("SendMail.GetSource"; $EmailID); 1)]
!
To send we need a CURL transfer. So you create a new CURL session and pass the email
sending settings. Next you can change some CURL settings like SSL settings or switch to
a different port. So for this example we do not check SSL certificates, but prefer TLS v1.2.!
!"
Set Variable [$curl; Value:MBS("CURL.New")]
Set Variable [$r; Value:MBS("SendMail.PrepareCURL"; $EmailID; $curl)]
#Maybe use alternative SMTP port?"
//! Set Variable [$r; Value:MBS("CURL.SetOptionPort"; $curl; 587)]
#This turns TLS on and requires connection to be encrypted"
Set Variable [$r; Value:MBS("CURL.SetOptionUseSSL"; $curl; 3)]
#force TLS v1.2"
Set Variable [$r; Value:MBS("CURL.SetOptionSSLVersion"; $curl; 6)]
#This disables certificate verification, so we accept any:!"
Set Variable [$r; Value:MBS("CURL.SetOptionSSLVerifyHost"; $curl; 0)]
Set Variable [$r; Value:MBS("CURL.SetOptionSSLVerifyPeer"; $curl; 0)]
#Better with certificates if you have some:"
//! Set Variable [$r; Value:MBS( "CURL.SetOptionCAInfo"; $curl; "/Library/FileMaker
Server/certificates.pem")]
//! Set Variable [$r; Value:MBS("CURL.SetOptionSSLVerifyHost"; $curl; 2)]
//! Set Variable [$r; Value:MBS("CURL.SetOptionSSLVerifyPeer"; $curl; 1)]
!
The perform call will actually do the transfer. Our plugin can do transfer synchronously, in
background threaded or asynchronously on main thread. This example uses synchronous
transfer, so the script waits for the transfer to finish. But you can also run in background or
asynchronously and later trigger a script to inform you about the result of the transfer.
!"
Set Variable [$r; Value:MBS("CURL.Perform"; $curl)]
!
You can show debug log and input in fields if you like:
!"
Set Field [EMail::DebugInput; MBS("CURL.GetInputAsText"; $curl)]
Set Field [EMail::DebugMessages; MBS("CURL.GetDebugAsText"; $curl)]
!
Finally you can do the cleanup:
!"
Set Variable [$r; Value:MBS("CURL.Cleanup"; $curl)]
Set Variable [$r; Value:MBS("SendMail.Release"; $EmailID)]
!
If you have trouble with setting this up, please contact us. Our plugin works fine with a lot
of smtp servers including google mail and outlook 365.