Prerequiste:
Need to get the Web Portal Registration List Id from silver pop
Execute the below code to send an email
Need to get the Web Portal Registration List Id from silver pop
Execute the below code to send an email
String xmlBody='<?xml version="1.0" encoding="UTF-8"?><Envelope><Body><AddRecipient><LIST_ID>Web Portal Registration List Id </LIST_ID><CREATED_FROM>2</CREATED_FROM><UPDATE_IF_FOUND>true</UPDATE_IF_FOUND><SEND_AUTOREPLY>true</SEND_AUTOREPLY><ALLOW_HTML>false</ALLOW_HTML><COLUMN><NAME>EMAIL</NAME><VALUE>xxxxx@gmail.com</VALUE></COLUMN><COLUMN><NAME>GUID</NAME><VALUE>d8a4ba8c-6fd0-acdb-1953-1726d797cb57</VALUE></COLUMN><COLUMN><NAME>FIRSTNAME</NAME><VALUE>xxx</VALUE></COLUMN><COLUMN><NAME>LASTNAME</NAME><VALUE>aaa</VALUE></COLUMN></AddRecipient></Body></Envelope>'; Http httpObj = new Http(); HttpRequest httpReq = new HttpRequest(); httpReq.setEndpoint('http://api2.silverpop.com/XMLAPI'); httpReq.setMethod('POST'); httpReq.setHeader('Content-Type', 'text/xml;charset=utf-8'); httpReq.setBody(xmlBody); HttpResponse httpResp = new HttpResponse(); try { httpResp = httpObj.send(httpReq); System.debug('Email Sent successfully'); } catch(Exception e) { System.debug('MEssage' + e.getMessage()); System.debug('sendEmail : ' + e.getStackTraceString()); }
No comments :
Post a Comment