Custom Emails
One of our customer have been having this issue where their iStore users are not getting their emails on Order Confirmation, Forgotten Password etc. They approached us for a solution that would be less dependent of Oracle Workflow emails. We have gone through these concerns plenty of times with lot of other previous customers. And the reason for this is that no one likes to depend on Oracle Workflow mailer process and lot of other functionalities that go with it. For eg. To change the subject or body of the message, there has to be one person in the organization who is very good with Oracle Workflow Builder and be able to change the content according to the requirements.
To circumvent this issue, we came up with our own little code, that can be embedded into any JSP. Primarily we started using this code in Forgotten Password and Order Confirmation emails. The Java based code is as follows
Properties props = new Properties();
props.put(“mail.smtp.host”, mailServer);
javax.mail.Session s = javax.mail.Session.getInstance(props,null);
MimeMessage message = new mimeMessage(s);
InternetAddress from = new InternetAddress(fromEmail);
message.setFrom(from);
InternetAddress to = new
InternetAddress(toEmail);
message.addRecipient(javax.mail.Message.RecipientType.TO, to);
message.setSubject(subject);
message.setText(message_zipsales);
Transport.send(message);
Please note that one has to define the following variables
mailserver
fromEmail
toEmail
One needs to consulting with the n/w engineer to figure out what the smtp host server name is and set the mailServer variable accordingly.
One can also send cc and/or bcc emails by adding the following lines
message.addRecipient(javax.mail.Message.RecipientType.CC, to);
message.addRecipient(javax.mail.Message.RecipientType.BCC, to);
There are no comments yet.