Notes regarding the Mass Mailer interface.
Local version of MassMailer available at: [\CAMM NET\Mass Mailer\CammnetThreadedMailer_10172013](\CAMM NET\Mass Mailer\CammnetThreadedMailer_10172013)
Code notes based on CammnetThreadedMailer.exe decompiled by dotPeek.
This function runs the various services (RunSolicitations [ProcessNewSolicitations], RunAddendums [ProcessAddendums], RunAwards [ProcessAwards], RunCancellations [ProcessCancellations], UseTestEmailAddresses) if they are true when MassMailer service is started.
MassMailer appears not to use DB views. It instead calls to tables such as vendor, vendoraddress, commcodelookup, and the like. Vendor email addresses are grabbed from vendoraddress.
First set sql1 equal to the following query. Next, create DataTable1 - Collect SolicitNums (for use with queries, and Email body/subject):
SELECT DISTINCT solicitnum, sflag FROM emailtracking WHERE sflag = '0' AND emaileddate is null
If there is at least one row of data, then create four more dataTables.
dataTable2 - Collect specific solicitation's Title, CloseDate, Type, AddendumNum (for Email Body):
SELECT solicittitle, TO_CHAR(solicitclosedate, 'MM/DD/YY')" + " solicitclosedate, solicittype, addendumnum" + " FROM solicitation" + " WHERE solicitnum = " + (string) row1.ItemArray[0] + " order by addendumnum DESC
dataTable3 - Collect specific solicitation's CA information (for Email body):
SELECT paname, paemailaddr, paphoneareacode, paphonenum, paphoneext" + " FROM pauser WHERE panum IN (SELECT panum FROM requisition r, solicitinstance s" + " WHERE r.reqidnum = s.reqidnum AND r.reqlinenum = s.reqlinenum" + " and r.reqinstancenum = s.reqinstancenum AND s.solicitnum = " + (string) row1.ItemArray[0] + ")"
dataTable4 - Collect specific solicitation's CommdityDesc (for Email body):
SELECT commoditydesc FROM newcommcodelookup WHERE commcode IN (" + "SELECT commcode FROM solicitcomm WHERE solicitnum = " + (string) row1.ItemArray[0] + ")"
dataTable5 - Collects all email addresses based on commodities of specific solicitation (for Email TO field):
SELECT DISTINCT vemailaddr FROM VENDORADDRESS" + " WHERE vemailaddr is not null and vendornum IN (SELECT vendornum FROM NEWCOMMODITYCODE" + " WHERE commcode IN (SELECT commcode FROM SOLICITCOMM" + " WHERE solicitnum = " + (string) row1.ItemArray[0] + "))"
Then use stringBuilder1/2 to build an email with text either about on-line or offline solicitation.
Then create an EmailObject with emailAddresses from dataTable5.
For each row in VENDORADDRESS, collect vemailaddr, vendornum and add them to emailObjs. When not in test mode, use SendMassMail function to send stringBuilder1/2 contents as a "New Solicitation" email from cammadmin@octa.net to the specific vendor email address. Repeat until the end of dataTable5 is reached.
//dataTable5 is vendoraddress records where commcodes match the ones neeeded per solicitation.
foreach (DataRow row2 in (InternalDataCollectionBase) dataTable5.Rows)
{
EmailObject emailObject = new EmailObject();
//grab Email Address field (vemailaddr)
emailObject.EmailAddress = (string) row2.ItemArray[0];
if (!this.shutdownRequested)
{
//grab vendornum for use with emailObject.
string sql2 = "SELECT to_char(VENDORNUM) FROM VENDORADDRESS WHERE VEMAILADDR = '" + (string) row2.ItemArray[0] + "'";
string str2 = "";
if (this.IsGoodEmailAddress(((string) row2.ItemArray[0]).Trim()))
str2 = (string) this.ConnectOracle(sql2, cn).Rows[0].ItemArray[0];
emailObject.VendorNum = str2;
emailObjs.Add((object) emailObject);
}
else
break;
}
if (!this.useTestEmailAddresses)
//send email with built string body contents to specified vendor email address
this.SendMassMail(subject, stringBuilder1.ToString(), stringBuilder2.ToString(), "cammadmin@octa.net", "New Solicition", (string) row1.ItemArray[0], emailObjs);
else
this.SendMassMail(subject, stringBuilder1.ToString(), stringBuilder2.ToString(), "cammadmin@octa.net", "New Solicition", (string) row1.ItemArray[0], this.BogusEOs);