I have a question about the WebService functions newEmailMailing and newEmailMailingWithReply.
I want to do the following:
- Create templates in OpenEMM
- Upload picture components to the templates
- Manage link tracking of the templates
- Use WebService/SOAP to automatically create a number of mailings with the newEmailMailing function
- Automatic delivery of new mailings through WebService sendMailing-calls
Since I want to automate the process I want to get rid of any manual steps required for sending the mailing.
I have looked a bit at the implementing code of the WebService, focusing on the org.agnitas.webservice.EmmWebservice class. Both newEmailMailing and newEmailMailingWithReply use the "loadTemplate" function to copy values from the template to the mailing.
Would it not be better if the loadTemplate function also copied TrackableLinks and components other than agnText/agnHtml (i.e. uploaded files etc) to the new mailing?
I would like to discuss this with other users and the OpenEMM team. What do you think? Does it make sense?
I have some (untested) example replacement code for a new loadTemplate function:
Code: Select all
private Mailing loadTemplate(Mailing aMailing, MailingDao mDao, ApplicationContext con) {
Mailing tmpMailing=(Mailing) con.getBean("Mailing");
MailingComponent tmpComp=null;
String htmlCompName=null;
String textCompName=null;
tmpMailing = mDao.getMailing(aMailing.getMailTemplateID(), aMailing.getCompanyID());
if(tmpMailing != null) {
aMailing.setMailingType(tmpMailing.getMailingType());
aMailing.setMailinglistID(tmpMailing.getMailinglistID());
aMailing.setTargetMode(tmpMailing.getTargetMode());
aMailing.setTargetGroups(tmpMailing.getTargetGroups());
aMailing.setMediatypes(tmpMailing.getMediatypes());
aMailing.setArchived(tmpMailing.getArchived());
aMailing.setCampaignID(tmpMailing.getCampaignID());
// load template for this mailing
if((tmpComp = tmpMailing.getHtmlTemplate()) != null) {
htmlCompName = tmpComp.getComponentName();
aMailing.setHtmlTemplate(tmpComp);
}
if((tmpComp = tmpMailing.getTextTemplate()) != null) {
textCompName = tmpComp.getComponentName();
aMailing.setTextTemplate(tmpComp);
}
Map tmpComponents = tmpMailing.getComponents();
if (tmpComponents != null) {
Iterator tmpComponentIter = tmpComponents.entrySet().iterator();
while (tmpComponentIter.hasNext()) {
Map.Entry entry = (Map.Entry) tmpComponentIter.next();
String name = (String) entry.getKey();
if (!name.equals(htmlCompName) && !name.equals(textCompName)) {
tmpComp = (MailingComponent) entry.getValue();
aMailing.addComponent(tmpComp);
}
}
}
aMailing.setMediatypes(tmpMailing.getMediatypes());
aMailing.setTrackableLinks(tmpMailing.getTrackableLinks());
}
return aMailing;
}