Contents
Introduction
In addition to batch email processing, ePriority offers a transactional mailing service via SMTP (Simple Mail Transfer Protocol) Relay. For clients who want to send email based on user website actions or other real-time events, an individual email can be delivered through ePriority with the same ease of use as any mail gateway. ePriority provides the same Delivery Profile features for transactional mail as it does for batch email processing. Using the ePriority SMTP Relay service is no more difficult than sending a message from your desktop mail client. With minimal setup required, any application can be empowered with transactional email support with extended tracking and scheduling features. If you have not already done so, you should read the «ePriority Service Overview» before going further with this document as it will provide context for all ePriority features.
Setup
In order to use the Relay Transaction service, a list of IP addresses (or ranges) from which mail will be delivered must be defined under the associated client account. This list can be updated from the Account Settings page on ePriority.com. Changes to this list will take affect within one hour (propogated to our inbound SMTP service is required). To better define the exact delivery behavior and features you want applied to your transaction email, profiles can be created from the administration web site and identified during the transactional mailing. A "default" profile is always available, but transactional mail often has different needs from batch deliveries.
Using Mail Relay
Once your IP ranges have been defined, profile(s) have been created, and you have waited at least one hour for changes to propogate, SMTP Relaying may be used.
Relay Transaction
When a client application contacts ePriority SMTP servers to perform a relay mail transaction, it will provide three values:
Example
Message Tracking
The CPID supplied in the MAIL FROM value during a relay transaction is used for message tracking. All tracking events are made available in logs (downloadable via FTP) in the exact same manner as our batch submission process. Please read our «Service Overview Guide» to learn more about how to download and process logs.
JavaMail Example
import java.util.*; import java.io.*; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*; public class Relay implements Serializable { public static void main( String[] args ) { Message message; Multipart multipart; String VERSION = "r3"; String CID = "1105"; String ID = "1234xyz"; String ID2 = "abc12345"; String ID3 = "78236y0b4"; String PROFILE = "default"; String recipient_address = "recipient@domain.com"; String sender_address = "sender@domain.com"; String body = "This is an example relay transaction message.\r\n\r\n" + "ePriority Development Team\r\n"; String smtpHostName = "mta2.epriority.com"; String smtpFromName = VERSION + "_" + CID + "_" + ID + "_" + ID2 + "_" + ID3 + "_" + PROFILE + "@relay.epriority.com"; Properties props = new Properties(); props.put( "mail.smtp.host", smtpHostName ); props.put( "mail.smtp.from", smtpFromName ); props.put( "mail.debug", "true" ); Session session = Session.getDefaultInstance( props, null ); message = new MimeMessage( session ); multipart = new MimeMultipart(); try { message.setRecipients( Message.RecipientType.TO, InternetAddress.parse( recipient_address, false ) ); message.setFrom( new InternetAddress( sender_address ) ); message.setSubject( "Relay Transaction Message" ); message.setSentDate( new Date() ); BodyPart messageBodyPart = new MimeBodyPart(); messageBodyPart.setText( body ); multipart.addBodyPart( messageBodyPart ); message.setContent( multipart ); Transport.send( message ); System.out.println( "Message sent successfully." ); } catch( Exception ex) { System.out.println( "Exception caught: " + ex.getMessage() ); } System.exit(0); } }
Perl Example
#!/lopt/perl/bin/perl use Net::SMTP; $RELAY_VERSION = 'r2'; $CLIENT_ID = 1105; $PROFILE_NM = 'default'; $EMAIL_ID = 1; $MAIL_FROM = $RELAY_VERSION . '_' . $CLIENT_ID . '_' . $EMAIL_ID . '_' . $PROFILE_NM . '@relay.epriority.com'; $FROM = 'returnmail@domain.com'; $FROM_NAME = 'Customer Support'; $TO = 'recipient@aol.com'; $TO_NAME = 'Bob Johnson'; $smtp = Net::SMTP->new('mta2.epriority.com'); $smtp->mail($MAIL_FROM); $smtp->to($RCPT_TO); $smtp->data(); $smtp->datasend("From: \"$FROM_NAME\" <$FROM>\n"); $smtp->datasend("To: \"$TO_NAME\" <$TO>\n"); $smtp->datasend("Subject: $SUBJECT\n"); $smtp->datasend("\n"); $smtp->datasend("This is a test message."); $smtp->dataend(); $smtp->quit; |