Dear {Patient First Name};
{Clinic Name} is partnering with {Hospital Name} for a pilot program that aims to improve customer satisfaction. We hope you’ll take the opportunity to answer a few questions related to your recent visit.
To participate in the survey, please click this link:
http://{Clinic Name}.{Hospital Name}.com/survey/{visit_id}
Sincerely,
Admin
We wouldn’t ask if we didn’t care™
PS> We will send automatic reminder e-mails if we don’t hear from you. To opt out of the survey, please click this link, instead: http://{Clinic Name}.{Hospital Name}.com/survey/{visit_id}/decline.
If the patient clicks the accept link then it has to open the survey form.
The e-mail invitation will be template-driven, with a few variable substitutions, shown in curly brackets ({}). Each pilot customer may want a slightly different template. The e-mail will be a multipart format with a professional HTML partwith images, fonts, and color that degrades smoothly to a simple text part.
Please let me know which technolgies to use and how?
/**
* @author madhan
*
*/
/*
* Copyright (c) Ian F. Darwin, http://www.darwinsys.com/, 1996-2002.
* All rights reserved. Software written by Ian F. Darwin and others.
* $Id: LICENSE,v 1.8 2004/02/09 03:33:38 ian Exp $
*/
/** SendMime -- send a multi-part MIME email message.
* @author Ian F. Darwin
* @version $Id: SendMime.java,v 1.8 2003/05/31 21:18:35 ian Exp $
*/
public class SendMime {
/** The message recipient. */
protected String message_recip = "madhan1979@gmail.com";
/* What's it all about, Alfie? */
protected String message_subject = "Re: your mail";
/** The message CC recipient. */
protected String message_cc = "madhan1979@gmail.com";
/** The text/plain message body */
protected String message_body =
"I am unable to attend to your message, as I am busy sunning " +
"myself on the beach in Maui, where it is warm and peaceful. " +
"Perhaps when I return I'll get around to reading your mail. " +
"Or perhaps not.";
/* The text/html data. */
protected String html_data =
"<HTML><HEAD><TITLE>My Goodness</TITLE></HEAD>" +
"<BODY><P>You <EM>do</EM> look a little " +
"<font color=green>GREEN</FONT>" +
"around the edges..." +
"</BODY></HTML>";
/** The JavaMail session object */
protected Session session;
/** The JavaMail message object */
protected Message mesg;
/** Do the work: send the mail to the SMTP server. */
public void doSend() throws IOException, MessagingException {
// We need to pass info to the mail server as a Properties, since
// JavaMail (wisely) allows room for LOTS of properties...
Properties props = new Properties();
props.put("mail.smtp.host", "www.gmail.com");
// Copy the value of Mail.send.host into mail.smtp.host
// props.setProperty("mail.smtp.host",
//props.getProperty(MailConstants.SEND_HOST));
/** Simple test case driver */
public static void main(String[] av) throws Exception {
SendMime sm = new SendMime();
sm.doSend();
}
}
If i execute the sample code above i get the following error:
DEBUG: setDebug: JavaMail version 1.4.4
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]
DEBUG SMTP: useEhlo true, useAuth false
DEBUG SMTP: trying to connect to host "www.gmail.com", port 25, isSSL false
javax.mail.MessagingException: Could not connect to SMTP host: www.gmail.com, port: 25;
nested exception is:
java.net.ConnectException: Connection timed out: connect
javax.mail.MessagingException: Could not connect to SMTP host: www.gmail.com, port: 25;
nested exception is:
java.net.ConnectException: Connection timed out: connect
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1934)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638)
at javax.mail.Service.connect(Service.java:295)
at javax.mail.Service.connect(Service.java:176)
at javax.mail.Service.connect(Service.java:125)
at javax.mail.Transport.send0(Transport.java:194)
at javax.mail.Transport.send(Transport.java:124)
at SendMime.doSend(SendMime.java:104)
at SendMime.main(SendMime.java:115)
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:288)
at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:231)
at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1900)
... 8 more
Not sure how the requirements you mentioned have anything to do with real-time scenarios, but unless you're using a special JVM noJava code is suitable for real-time use.
James implements SMTP, so it can communicate with any other standards-compliant SMTP server. If you're serious about using email in your applications you should read up on mail protocols like SMTP (in particular), POP3 and IMAP.
Post by:autobot
I wasn't selected to go to mars. This tiny ad got in ahead of me:
a bit of art, as a gift, that will fit in a stocking