Send Button
This script demonstrates a large feature set of sending a HTML based message with SMTPit Pro. It uses all of the email fields on the layout. In order to send a message with the pure basics, take a look at the "Send (Simple)" script. This example, however, takes advantage of several SMTPit Pro features including Reply-To, CC, BCC, Header, and Footer.
The calculation has several comments in it to help clarify what all it is doing. To see how to view the calculation, look at the Accessing the Plug-in section.
The calculation can be broken down into six basic steps:
SMTPit_Clear & "¶" &
It is important to clear out old values before setting new ones so that you do not get unexpected results. If you have set a value in a previous message that is not being set in the current message, the value from the previous message will still be used. For example, if you set a header in your previous message, but you are not setting the header in your current message, the header from the previous message will be used in your current message. The plug-in is purposefully set up this way so that you can set a value and then use it across several emails. For example, you may want to set the body with some specific text and then use a personalized header for each record in a found set. Under this circumstance, it makes sense to set the body once rather than for each record. Also note that you can clear specific values with the clear function. Be sure to visit the Functions tab or click on the SMTPit_Clear function for more details.
2. Set host and authenticationSMTPit_SetHost( Email::Host ; Email::Port ) & "¶" &
SMTPit_SetAuthentication( Email::Authentication Type ; Email::Username ; Email::Password ; Email::SSL ) & "¶" &
You can set up the host and authentication a couple of different ways. You can do as we have here and use functions, or you can use the SMTPit Pro configuration dialog. It may be that your specific host does not even support authentication. It is up to you to determine what approach will best suit your needs.
3. Set from, Reply-To, and other recipientsSMTPit_SetFrom( Email::From ) & "¶" &
SMTPit_SetReplyTo( Email::ReplyTo ) & "¶" &
SMTPit_SetTo( Email::To ) & "¶" &
SMTPit_SetCC( Email::CC ) & "¶" &
SMTPit_SetBCC( Email::BCC ) & "¶" &
In this portion of the calculation, we set the From, Reply-To, and the other recipients.
4. Set subject and prioritySMTPit_SetSubject( Email::Subject ) & "¶" &
SMTPit_SetPriority( Email::Priority ) & "¶" &
This sets the Subject and Priority.
5. Set header, body, and footerSMTPit_SetBodyHeader( Email::Header ; "HTML" ) & "¶" &
SMTPit_SetBody( Email::Body ; "HTML" ) & "¶" &
SMTPit_SetBodyFooter( Email::Footer ; "HTML" ) & "¶" &
In this portion of the calculation, we set the Body Header, Body, and Body Footer.
6. Send the messageSMTPit_Send( Email::GetTranscript ) & "¶¶"
Finally, we send the message using the SMTPit_Send function. The send function has two optional parameters that you can use if so desired.
Conclusion...
If you take out all of the comments, and your host and authentication is set up in the SMTPit Pro preferences, you could use the following calculation to send this basic message, and the result field will return the status of each function in a readable manner:
SMTPit_Clear & "¶" &
SMTPit_SetFrom( Email::From ) & "¶" &
SMTPit_SetTo( Email::To ) & "¶" &
SMTPit_SetSubject( Email::Subject ) & "¶" &
SMTPit_SetBody( Email::Body ; "HTML" ) & "¶" &
SMTPit_Send