cvs commit: ant/docs/manual/CoreTasks mail.html
peterreilly2005/03/03 01:58:47 Modified:docs/manual/CoreTasks mail.html Log: Error in mail task sample PR: 33828 Obtained from: Geir Ole Aagedal Revision ChangesPath 1.26 +1 -1 ant/docs/manual/CoreTasks/mail.html Index: mail.html === RCS file: /home/cvs/ant/docs/manual/CoreTasks/mail.html,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- mail.html 2 Feb 2005 20:08:57 - 1.25 +++ mail.html 3 Mar 2005 09:58:47 - 1.26 @@ -257,7 +257,7 @@ lt;to address=quot;[EMAIL PROTECTED]quot;/gt; lt;messagegt;The ${buildname} nightly build has completedlt;/messagegt; lt;fileset dir=quot;distquot;gt; -lt;includes name=quot;**/*.zipquot;/gt; +lt;include name=quot;**/*.zipquot;/gt; lt;/filesetgt; lt;/mailgt; /pre/blockquote - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: ant/docs/manual/CoreTasks mail.html
peterreilly2005/03/03 01:59:06 Modified:docs/manual/CoreTasks Tag: ANT_16_BRANCH mail.html Log: sync Revision ChangesPath No revision No revision 1.21.2.5 +2 -2 ant/docs/manual/CoreTasks/mail.html Index: mail.html === RCS file: /home/cvs/ant/docs/manual/CoreTasks/mail.html,v retrieving revision 1.21.2.4 retrieving revision 1.21.2.5 diff -u -r1.21.2.4 -r1.21.2.5 --- mail.html 19 Nov 2004 09:10:00 - 1.21.2.4 +++ mail.html 3 Mar 2005 09:59:06 - 1.21.2.5 @@ -233,7 +233,7 @@ lt;to address=quot;[EMAIL PROTECTED]quot;/gt; lt;messagegt;The ${buildname} nightly build has completedlt;/messagegt; lt;fileset dir=quot;distquot;gt; -lt;includes name=quot;**/*.zipquot;/gt; +lt;include name=quot;**/*.zipquot;/gt; lt;/filesetgt; lt;/mailgt; /pre/blockquote @@ -260,7 +260,7 @@ iTest Build/i, the message body being coded in UTF-8 hr -p align=centerCopyright copy; 2000-2004 The Apache Software Foundation. All rights +p align=centerCopyright copy; 2000-2005 The Apache Software Foundation. All rights Reserved./p /body - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: ant/docs/manual/CoreTasks mail.html
antoine 2003/05/27 08:33:25 Modified:docs/manual listeners.html docs/manual/CoreTasks mail.html Log: had forgotten to submit manual pages, oops PR: 5969 Revision ChangesPath 1.13 +12 -0 ant/docs/manual/listeners.html Index: listeners.html === RCS file: /home/cvs/ant/docs/manual/listeners.html,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- listeners.html15 May 2003 11:30:27 - 1.12 +++ listeners.html27 May 2003 15:33:25 - 1.13 @@ -126,6 +126,18 @@ td width=63%No, default quot;25quot;/td /tr tr +td width=337MailLogger.user/td +td width=63%user name for SMTP auth/td +td width=63%Yes, if SMTP auth is required on your SMTP serverbr/ +the email message will be then sent using Mime and requires JavaMail/td + /tr + tr +td width=337MailLogger.password/td +td width=63%password for SMTP auth/td +td width=63%Yes, if SMTP auth is required on your SMTP serverbr/ +the email message will be then sent using Mime and requires JavaMail/td + /tr + tr td width=337MailLogger.from/td td width=63%Mail quot;fromquot; address/td td width=63%Yes, if mail needs to be sent/td 1.19 +19 -3 ant/docs/manual/CoreTasks/mail.html Index: mail.html === RCS file: /home/cvs/ant/docs/manual/CoreTasks/mail.html,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- mail.html 15 May 2003 11:30:26 - 1.18 +++ mail.html 27 May 2003 15:33:25 - 1.19 @@ -9,8 +9,11 @@ h2a name=mailMail/a/h2 h3Description/h3 -pA task to send SMTP email. This task can send mail using either plain -text, UU encoding, or MIME format mail, depending on what is available. +pA task to send SMTP email.br/br/ +This task can send mail using either plain +text, UU encoding, or MIME format mail, depending on what is available.br/ +br/ +If you need SMTP auth, you have to use MIME (and therefore to install JavaMail).br/br/ Attachments may be sent using nested a href=../CoreTypes/fileset.htmlfileset/a elements./p pstrongNote:/strong This task may depend on external libraries @@ -99,10 +102,23 @@ td align=center valign=topNo/td /tr tr +td valign=topuser/td +td valign=topuser name for SMTP auth/td +td valign=centerYes, if SMTP auth is required on your SMTP serverbr/ +the email message will be then sent using Mime and requires JavaMail/td + /tr + tr +td valign=toppassword/td +td valign=toppassword for SMTP auth/td +td valign=centerYes, if SMTP auth is required on your SMTP serverbr/ +the email message will be then sent using Mime and requires JavaMail/td + /tr + tr td valign=topencoding/td td valign=topSpecifies the encoding to use for the content of the email. Values are codemime/code, codeuu/code, codeplain/code, or - codeauto/code. The default value is codeauto/code./td + codeauto/code. The default value is codeauto/code. + codeuu/code or codeplain/code are not compatible with SMTP auth/td td align=center valign=topNo/td /tr tr
cvs commit: ant/docs/manual/CoreTasks mail.html
antoine 2003/04/17 10:09:35 Modified:src/main/org/apache/tools/ant/taskdefs/email MimeMailer.java Message.java EmailTask.java docs/manual/CoreTasks mail.html Log: add international support for mailtask - bug report 15434 Revision ChangesPath 1.9 +103 -10 ant/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java Index: MimeMailer.java === RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- MimeMailer.java 10 Feb 2003 14:13:45 - 1.8 +++ MimeMailer.java 17 Apr 2003 17:09:35 - 1.9 @@ -1,7 +1,7 @@ /* * The Apache Software License, Version 1.1 * - * Copyright (c) 2002 The Apache Software Foundation. All rights + * Copyright (c) 2002-2003 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without @@ -53,16 +53,23 @@ */ package org.apache.tools.ant.taskdefs.email; +import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; import java.io.PrintStream; import java.io.UnsupportedEncodingException; + import java.util.Enumeration; import java.util.Properties; +import java.util.StringTokenizer; import java.util.Vector; + import javax.activation.DataHandler; import javax.activation.FileDataSource; + import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; @@ -72,17 +79,75 @@ import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; + import org.apache.tools.ant.BuildException; /** * Uses the JavaMail classes to send Mime format email. * * @author [EMAIL PROTECTED] Rob Oxspring + * @author a href=mailto:[EMAIL PROTECTED]Aleksandr Ishutin/a * @since Ant 1.5 */ class MimeMailer extends Mailer { -/** Sends the email */ -public void send() { +// Default character set +private static final String defaultCharset = System.getProperty(file.encoding); + +// To work poperly with national charsets we have to use +// implementation of interface javax.activation.DataSource +/** + * @since Ant 1.6 + */ +class StringDataSource implements javax.activation.DataSource { + private String data=null; + private String type=null; + private String charset = null; + private ByteArrayOutputStream out; + + public InputStream getInputStream() throws IOException { +if(data == null out == null) + throw new IOException(No data); +else { + if(out!=null) { + data=(data!=null)?data.concat(out.toString(charset)):out.toString(charset); +out=null; + } + return new ByteArrayInputStream(data.getBytes(charset)); +} + } + + public OutputStream getOutputStream() throws IOException { +if(out==null) { + out=new ByteArrayOutputStream(); +} +return out; + } + + public void setContentType(String type) { +this.type=type.toLowerCase(); + } + + public String getContentType() { +if(type !=null type.indexOf(charset)0 type.startsWith(text/)) + return type; +// Must be like text/plain; charset=windows-1251 +return type!=null?type.concat(; charset=.concat(charset)): + text/plain.concat(; charset=.concat(charset)); + } + + public String getName() { +return StringDataSource; + } + public void setCharset(String charset) { +this.charset = charset; + } + public String getCharset() { +return charset; + } + } + + /** Sends the email */ + public void send() { try { Properties props = new Properties(); @@ -113,20 +178,38 @@ msg.setRecipients(Message.RecipientType.BCC, internetAddresses(bccList)); -if (subject != null) { -msg.setSubject(subject); +// Choosing character set of the mail message +// First: looking it from MimeType +String charset = parseCharSetFromMimeType(message.getMimeType()); +if(charset!=null) { + // Assign/reassign message charset from MimeType +message.setCharset(charset); } -msg.addHeader(Date, getDate()); +// Next: looking if charset having explict definition +
cvs commit: ant/docs/manual/CoreTasks mail.html
bodewig 2003/03/28 07:02:53 Modified:docs/manual/CoreTasks mail.html Log: files attribute splits at spaces as well. Revision ChangesPath 1.15 +2 -2 ant/docs/manual/CoreTasks/mail.html Index: mail.html === RCS file: /home/cvs/ant/docs/manual/CoreTasks/mail.html,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- mail.html 23 Sep 2002 16:14:00 - 1.14 +++ mail.html 28 Mar 2003 15:02:53 - 1.15 @@ -65,7 +65,7 @@ tr td valign=topfiles/td td valign=topFiles to send as attachments to the email. Separate multiple -file names using a comma. You can also use codelt;filesetgt;/code +file names using a comma or space. You can also use codelt;filesetgt;/code elements to specify files./td td align=center valign=topNo/td /tr @@ -188,7 +188,7 @@ that order depending on what support classes are available. code${buildname}/code will be replaced with the codebuildname/code property's value./p hr -p align=centerCopyright copy; 2000-2002 Apache Software Foundation. All rights +p align=centerCopyright copy; 2000-2003 Apache Software Foundation. All rights Reserved./p /body
cvs commit: ant/docs/manual/CoreTasks mail.html
bodewig 2003/03/28 07:05:11 Modified:docs/manual/CoreTasks Tag: ANT_15_BRANCH mail.html Log: files attribute splits at spaces as well. Revision ChangesPath No revision No revision 1.10.2.7 +2 -2 ant/docs/manual/CoreTasks/mail.html Index: mail.html === RCS file: /home/cvs/ant/docs/manual/CoreTasks/mail.html,v retrieving revision 1.10.2.6 retrieving revision 1.10.2.7 diff -u -r1.10.2.6 -r1.10.2.7 --- mail.html 23 Sep 2002 16:15:48 - 1.10.2.6 +++ mail.html 28 Mar 2003 15:05:11 - 1.10.2.7 @@ -65,7 +65,7 @@ tr td valign=topfiles/td td valign=topFiles to send as attachments to the email. Separate multiple -file names using a comma. You can also use codelt;filesetgt;/code +file names using a comma or space. You can also use codelt;filesetgt;/code elements to specify files./td td align=center valign=topNo/td /tr @@ -188,7 +188,7 @@ that order depending on what support classes are available. code${buildname}/code will be replaced with the codebuildname/code property's value./p hr -p align=centerCopyright copy; 2000-2002 Apache Software Foundation. All rights +p align=centerCopyright copy; 2000-2003 Apache Software Foundation. All rights Reserved./p /body