| 1 |
module juno.examples.com.latebinding; |
|---|
| 2 |
|
|---|
| 3 |
import juno.com.core, juno.com.client; |
|---|
| 4 |
|
|---|
| 5 |
void main() { |
|---|
| 6 |
// Create an instance of the Message object |
|---|
| 7 |
scope message = new DispatchObject("CDO.Message"); |
|---|
| 8 |
|
|---|
| 9 |
// Build the mail message |
|---|
| 10 |
message.set("Subject", "Hello, World!"); |
|---|
| 11 |
message.set("TextBody", "Just saying Hello."); |
|---|
| 12 |
message.set("From", "me@home.com"); // Replace 'me@home.com' with your email address |
|---|
| 13 |
message.set("To", "world@large.com"); // Replace 'world@large.com' with the recipient's email address |
|---|
| 14 |
|
|---|
| 15 |
// Configure CDOSYS to send via a remote SMTP server |
|---|
| 16 |
|
|---|
| 17 |
scope config = message.get("Configuration"); |
|---|
| 18 |
|
|---|
| 19 |
// Set the appropriate values |
|---|
| 20 |
config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/sendusing", 2); // cdoSendUsingPort = 2 |
|---|
| 21 |
|
|---|
| 22 |
config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25); |
|---|
| 23 |
|
|---|
| 24 |
config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/smtpserver", "mail.remote.com"); // Replace 'mail.remote.com' with your remote server's address |
|---|
| 25 |
|
|---|
| 26 |
// Set the authentication type, user name and password |
|---|
| 27 |
|
|---|
| 28 |
config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1); // cdoBasic = 1 |
|---|
| 29 |
|
|---|
| 30 |
config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/sendusername", "username"); // Replace 'username' with your account's user name |
|---|
| 31 |
|
|---|
| 32 |
config.set("Fields", "http://schemas.microsoft.com/cdo/configuration/sendpassword", "password"); // Replace 'password' with your account's password |
|---|
| 33 |
|
|---|
| 34 |
scope fields = config.get("Fields"); |
|---|
| 35 |
fields.call("Update"); |
|---|
| 36 |
|
|---|
| 37 |
message.call("Send"); |
|---|
| 38 |
} |
|---|