import PT_MCF_MAIL:*;
/**** Send Mail ****/
Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail();
&email.From = "PSCSMPRA@up.ac.za";
SQLExec("select EMAILID from PSUSEREMAIL where OPRID=:1 and Primary_email = 'Y'", %OperatorId, &Email_To);
&email.Recipients = &Email_To;
&email.Subject = %DbName | ": Update Dual Class Sections to English";
Local string &plain_text = "Please see report output attached for Class Section update from Dual to English (D100 to E100).";
Local PT_MCF_MAIL:MCFBodyPart &text = create PT_MCF_MAIL:MCFBodyPart();
&text.Text = &plain_text;
&File_name_path = GetCwd() | "\files\Dual_UpdatedTo_English.csv";
&file_name_email = "Dual_UpdatedTo_English.csv";
&File_name_path2 = GetCwd() | "\files\English_ClassSection_Exist.csv";
&file_name_email2 = "English_ClassSection_Exist.csv";
Local PT_MCF_MAIL:MCFBodyPart &attach1 = create PT_MCF_MAIL:MCFBodyPart();
Local PT_MCF_MAIL:MCFBodyPart &attach2 = create PT_MCF_MAIL:MCFBodyPart();
&attach1.SetAttachmentContent(&File_name_path, %FilePath_Absolute, &file_name_email, "Report Description", "", "");
&attach2.SetAttachmentContent(&File_name_path2, %FilePath_Absolute, &file_name_email2, "Report Description 2", "", "");
Local PT_MCF_MAIL:MCFMultipart &mp = create PT_MCF_MAIL:MCFMultipart();
&mp.AddBodyPart(&text);
&mp.AddBodyPart(&attach1);
&mp.AddBodyPart(&attach2);
&email.MultiPart = ∓
Local integer &res = &email.Send();
Local boolean &done;
Evaluate &resp
When %ObEmail_Delivered
/* every thing ok */
&done = True;
Break;
When %ObEmail_NotDelivered
/*-- Check &email.InvalidAddresses, &email.ValidSentAddresses
and &email.ValidUnsentAddresses */
&done = False;
Break;
When %ObEmail_PartiallyDelivered
/* Check &email.InvalidAddresses, &email.ValidSentAddresses
and &email.ValidUnsentAddresses; */
&done = True;
Break;
When %ObEmail_FailedBeforeSending
/* Get the Message Set Number, message number;
Or just get the formatted messages from &email.ErrorDescription,
&email.ErrorDetails;*/
&done = False;
Break;
End-Evaluate;
/**** Send Mail ****/
Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail();
&email.From = "PSCSMPRA@up.ac.za";
SQLExec("select EMAILID from PSUSEREMAIL where OPRID=:1 and Primary_email = 'Y'", %OperatorId, &Email_To);
&email.Recipients = &Email_To;
&email.Subject = %DbName | ": Update Dual Class Sections to English";
Local string &plain_text = "Please see report output attached for Class Section update from Dual to English (D100 to E100).";
Local PT_MCF_MAIL:MCFBodyPart &text = create PT_MCF_MAIL:MCFBodyPart();
&text.Text = &plain_text;
&File_name_path = GetCwd() | "\files\Dual_UpdatedTo_English.csv";
&file_name_email = "Dual_UpdatedTo_English.csv";
&File_name_path2 = GetCwd() | "\files\English_ClassSection_Exist.csv";
&file_name_email2 = "English_ClassSection_Exist.csv";
Local PT_MCF_MAIL:MCFBodyPart &attach1 = create PT_MCF_MAIL:MCFBodyPart();
Local PT_MCF_MAIL:MCFBodyPart &attach2 = create PT_MCF_MAIL:MCFBodyPart();
&attach1.SetAttachmentContent(&File_name_path, %FilePath_Absolute, &file_name_email, "Report Description", "", "");
&attach2.SetAttachmentContent(&File_name_path2, %FilePath_Absolute, &file_name_email2, "Report Description 2", "", "");
Local PT_MCF_MAIL:MCFMultipart &mp = create PT_MCF_MAIL:MCFMultipart();
&mp.AddBodyPart(&text);
&mp.AddBodyPart(&attach1);
&mp.AddBodyPart(&attach2);
&email.MultiPart = ∓
Local integer &res = &email.Send();
Local boolean &done;
Evaluate &resp
When %ObEmail_Delivered
/* every thing ok */
&done = True;
Break;
When %ObEmail_NotDelivered
/*-- Check &email.InvalidAddresses, &email.ValidSentAddresses
and &email.ValidUnsentAddresses */
&done = False;
Break;
When %ObEmail_PartiallyDelivered
/* Check &email.InvalidAddresses, &email.ValidSentAddresses
and &email.ValidUnsentAddresses; */
&done = True;
Break;
When %ObEmail_FailedBeforeSending
/* Get the Message Set Number, message number;
Or just get the formatted messages from &email.ErrorDescription,
&email.ErrorDetails;*/
&done = False;
Break;
End-Evaluate;
Comments
Post a Comment