commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r481096 - /jakarta/commons/proper/email/trunk/xdocs/userguide.xml
Date Thu, 30 Nov 2006 22:30:33 GMT
Author: bayard
Date: Thu Nov 30 14:30:31 2006
New Revision: 481096

URL: http://svn.apache.org/viewvc?view=rev&rev=481096
Log:
Adding the necessary import statements for the examples to underline that the package is 'mail'
and not 'email'

Modified:
    jakarta/commons/proper/email/trunk/xdocs/userguide.xml

Modified: jakarta/commons/proper/email/trunk/xdocs/userguide.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/email/trunk/xdocs/userguide.xml?view=diff&rev=481096&r1=481095&r2=481096
==============================================================================
--- jakarta/commons/proper/email/trunk/xdocs/userguide.xml (original)
+++ jakarta/commons/proper/email/trunk/xdocs/userguide.xml Thu Nov 30 14:30:31 2006
@@ -31,13 +31,16 @@
       </p>
       <source>
 <![CDATA[
-SimpleEmail email = new SimpleEmail();
-email.setHostName("mail.myserver.com");
-email.addTo("jdoe@somewhere.org", "John Doe");
-email.setFrom("me@apache.org", "Me");
-email.setSubject("Test message");
-email.setMsg("This is a simple test of commons-email");
-email.send();
+import org.apache.commons.mail.SimpleEmail;
+...
+
+  SimpleEmail email = new SimpleEmail();
+  email.setHostName("mail.myserver.com");
+  email.addTo("jdoe@somewhere.org", "John Doe");
+  email.setFrom("me@apache.org", "Me");
+  email.setSubject("Test message");
+  email.setMsg("This is a simple test of commons-email");
+  email.send();
 ]]></source>
       <p>
         The call to setHostName("mail.myserver.com") sets the address of the
@@ -63,26 +66,29 @@
       </p>
       <source>
 <![CDATA[
-// Create the attachment
-EmailAttachment attachment = new EmailAttachment();
-attachment.setPath("mypictures/john.jpg");
-attachment.setDisposition(EmailAttachment.ATTACHMENT);
-attachment.setDescription("Picture of John");
-attachment.setName("John");
-
-// Create the email message
-MultiPartEmail email = new MultiPartEmail();
-email.setHostName("mail.myserver.com");
-email.addTo("jdoe@somewhere.org", "John Doe");
-email.setFrom("me@apache.org", "Me");
-email.setSubject("The picture");
-email.setMsg("Here is the picture you wanted");
+import org.apache.commons.mail.*;
+...
+
+  // Create the attachment
+  EmailAttachment attachment = new EmailAttachment();
+  attachment.setPath("mypictures/john.jpg");
+  attachment.setDisposition(EmailAttachment.ATTACHMENT);
+  attachment.setDescription("Picture of John");
+  attachment.setName("John");
+
+  // Create the email message
+  MultiPartEmail email = new MultiPartEmail();
+  email.setHostName("mail.myserver.com");
+  email.addTo("jdoe@somewhere.org", "John Doe");
+  email.setFrom("me@apache.org", "Me");
+  email.setSubject("The picture");
+  email.setMsg("Here is the picture you wanted");
 
-// add the attachment
-email.attach(attachment);
+  // add the attachment
+  email.attach(attachment);
 
-// send the email
-email.send();
+  // send the email
+  email.send();
 ]]></source>
       <p>
         You can also use EmailAttachment to reference any valid URL for files
@@ -95,26 +101,29 @@
       </p>
       <source>
 <![CDATA[
-// Create the attachment
-EmailAttachment attachment = new EmailAttachment();
-attachment.setURL(new URL("http://www.apache.org/images/asf_logo_wide.gif"));
-attachment.setDisposition(EmailAttachment.ATTACHMENT);
-attachment.setDescription("Apache logo");
-attachment.setName("Apache logo");
-
-// Create the email message
-MultiPartEmail email = new MultiPartEmail();
-email.setHostName("mail.myserver.com");
-email.addTo("jdoe@somewhere.org", "John Doe");
-email.setFrom("me@apache.org", "Me");
-email.setSubject("The logo");
-email.setMsg("Here is Apache's logo");
+import org.apache.commons.mail.*;
+...
 
-// add the attachment
-email.attach(attachment);
+  // Create the attachment
+  EmailAttachment attachment = new EmailAttachment();
+  attachment.setURL(new URL("http://www.apache.org/images/asf_logo_wide.gif"));
+  attachment.setDisposition(EmailAttachment.ATTACHMENT);
+  attachment.setDescription("Apache logo");
+  attachment.setName("Apache logo");
+
+  // Create the email message
+  MultiPartEmail email = new MultiPartEmail();
+  email.setHostName("mail.myserver.com");
+  email.addTo("jdoe@somewhere.org", "John Doe");
+  email.setFrom("me@apache.org", "Me");
+  email.setSubject("The logo");
+  email.setMsg("Here is Apache's logo");
+  
+  // add the attachment
+  email.attach(attachment);
 
-// send the email
-email.send();
+  // send the email
+  email.send();
 ]]></source>
     </section>
     <section name="Sending HTML formatted email">
@@ -130,25 +139,28 @@
       </p>
       <source>
 <![CDATA[
-// Create the email message
-HtmlEmail email = new HtmlEmail();
-email.setHostName("mail.myserver.com");
-email.addTo("jdoe@somewhere.org", "John Doe");
-email.setFrom("me@apache.org", "Me");
-email.setSubject("Test email with inline image");
-
-// embed the image and get the content id
-URL url = new URL("http://www.apache.org/images/asf_logo_wide.gif");
-String cid = email.embed(url, "Apache logo");
+import org.apache.commons.mail.HtmlEmail;
+...
 
-// set the html message
-email.setHtmlMsg("<html>The apache logo - <img src=\"cid:"+cid+"\"></html>");
+  // Create the email message
+  HtmlEmail email = new HtmlEmail();
+  email.setHostName("mail.myserver.com");
+  email.addTo("jdoe@somewhere.org", "John Doe");
+  email.setFrom("me@apache.org", "Me");
+  email.setSubject("Test email with inline image");
+  
+  // embed the image and get the content id
+  URL url = new URL("http://www.apache.org/images/asf_logo_wide.gif");
+  String cid = email.embed(url, "Apache logo");
+  
+  // set the html message
+  email.setHtmlMsg("<html>The apache logo - <img src=\"cid:"+cid+"\"></html>");
 
-// set the alternative message
-email.setTextMsg("Your email client does not support HTML messages");
+  // set the alternative message
+  email.setTextMsg("Your email client does not support HTML messages");
 
-// send the email
-email.send();
+  // send the email
+  email.send();
 ]]></source>
       <p>
         First, notice that the call to embed() returns a String.  This String



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message