|
|
|
 |
Open of w_emailer:
|
string ReplaceMe = "Replace this text with the message to be emailed..."
st_helper.text = "Connecting to the database now..."
CONNECT USING SQLCA;
IF SQLCA.SQLCODE <> 0 and SQLCA.SQLCODE <> -1 THEN
MessageBox("SQLCODE ->" + STRING(SQLCA.SQLCODE) + "<-",SQLCA.SQLERRTEXT)
HALT
END IF
//Put text in box for messagetext
mle_messagetext.text = ReplaceMe
mle_messagetext.SelectText(1,len(ReplaceMe))
mle_messagetext.Setfocus()
//Launch the datawindow control
dwc_emaillookup.SetTransObject(SQLCA)
dwc_emaillookup.Retrieve()
st_helper.text = "Connected to the database OK..."
 |
Modified of mle_messagetext:
MessageToSend = mle_messagetext.Text
st_helper.Text = "Next, click on each recipient. Click on Close when you're finished..."
|
 |
Clicked of dwc_emaillookup:
//Following are data types for email session
mailSession ThisMailSession
mailMessage ThisMailMessage
mailRecipient ThisMailRecipient
integer EntityId, UserResponse
string EmailAddress
EntityId = dwc_emaillookup.GetItemNumber(row,"id")
EmailAddress = dwc_emaillookup.GetItemString(row,"email_address")
//Find out if they really want to sent the email, do it if they do.
UserResponse = messagebox("About to send email:", "Do you want to send email to Entity #" + string(EntityId) + ", " + EmailAddress
&
+ "?",Question!,
YesNo!, 2)
if UserResponse = 2 then
//nothing to do about it
else
ThisMailSession = CREATE mailsession
st_helper.Text = "Logging on to the mail session now..."
if ThisMailSession.mailLogon(MailNewSession!) <> mailReturnSuccess! then
messagebox("Error logging onto mail session","This logon attempt failed for the reason stated by the MAPI client. Please
&
fix it and try again...")
close(parent)
end if
st_helper.Text = "Sending email next..."
ThisMailRecipient.Name = EmailAddress
ThisMailMessage.Recipient[1] = ThisMailRecipient
ThisMailMessage.Subject = "!*!*Testing from 9009*!*!"
ThisMailMessage.NoteText = MessageToSend
ThisMailSession.mailSend(ThisMailMessage)
ThisMailSession.mailLogoff()
DESTROY ThisMailSession
st_helper.Text = "Click on others or Close..."
end if
|
 |
Clicked of cb_close:
close(parent)
|
|