<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=Using_javax.mail</id>
	<title>Using javax.mail - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://performiq.com/kb/index.php?action=history&amp;feed=atom&amp;title=Using_javax.mail"/>
	<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Using_javax.mail&amp;action=history"/>
	<updated>2026-04-04T09:58:59Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://performiq.com/kb/index.php?title=Using_javax.mail&amp;diff=2825&amp;oldid=prev</id>
		<title>PeterHarding at 00:22, 4 December 2008</title>
		<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Using_javax.mail&amp;diff=2825&amp;oldid=prev"/>
		<updated>2008-12-04T00:22:53Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:22, 4 December 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l14&quot;&gt;Line 14:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 14:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          String host =  &amp;quot;smtp&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          String host =  &amp;quot;smtp&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          String fromAddress = &amp;quot;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;test&lt;/del&gt;@&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;enpysoft&lt;/del&gt;.com&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          String fromAddress = &amp;quot;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;xxx&lt;/ins&gt;@&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;xxxx&lt;/ins&gt;.com&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;.au&lt;/ins&gt;&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          String toAddress = &amp;quot;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;muthuselvan&lt;/del&gt;@&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;adventnet&lt;/del&gt;.com&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          String toAddress = &amp;quot;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;yyy&lt;/ins&gt;@&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;yyyy&lt;/ins&gt;.com&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;.au&lt;/ins&gt;&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          String filename = &amp;quot;C://docs//invitation.tiff&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          String filename = &amp;quot;C://docs//invitation.tiff&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          String subj = &amp;quot;Invitation&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;          String subj = &amp;quot;Invitation&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>PeterHarding</name></author>
	</entry>
	<entry>
		<id>https://performiq.com/kb/index.php?title=Using_javax.mail&amp;diff=2824&amp;oldid=prev</id>
		<title>PeterHarding: New page: &lt;pre&gt;  import java.util.*; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*;  public class MailWithAttachment {    public static void main(String[] args)    {  ...</title>
		<link rel="alternate" type="text/html" href="https://performiq.com/kb/index.php?title=Using_javax.mail&amp;diff=2824&amp;oldid=prev"/>
		<updated>2008-12-04T00:22:02Z</updated>

		<summary type="html">&lt;p&gt;New page: &amp;lt;pre&amp;gt;  import java.util.*; import javax.mail.*; import javax.mail.internet.*; import javax.activation.*;  public class MailWithAttachment {    public static void main(String[] args)    {  ...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
import java.util.*;&lt;br /&gt;
import javax.mail.*;&lt;br /&gt;
import javax.mail.internet.*;&lt;br /&gt;
import javax.activation.*;&lt;br /&gt;
&lt;br /&gt;
public class MailWithAttachment&lt;br /&gt;
{&lt;br /&gt;
   public static void main(String[] args)&lt;br /&gt;
   {&lt;br /&gt;
      try {&lt;br /&gt;
         java.util.Properties mailprop = new java.util.Properties();&lt;br /&gt;
&lt;br /&gt;
         String host =  &amp;quot;smtp&amp;quot;;&lt;br /&gt;
         String fromAddress = &amp;quot;test@enpysoft.com&amp;quot;;&lt;br /&gt;
         String toAddress = &amp;quot;muthuselvan@adventnet.com&amp;quot;;&lt;br /&gt;
         String filename = &amp;quot;C://docs//invitation.tiff&amp;quot;;&lt;br /&gt;
         String subj = &amp;quot;Invitation&amp;quot;;&lt;br /&gt;
         String content = &amp;quot;XXX,\n\txxxxxx\n\nRegards,\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
         mailprop.put(&amp;quot;mail.smtp.host&amp;quot;,host);&lt;br /&gt;
&lt;br /&gt;
         Session session = Session.getInstance(mailprop,null);&lt;br /&gt;
&lt;br /&gt;
         MimeMessage message = new MimeMessage(session);&lt;br /&gt;
&lt;br /&gt;
         message.setFrom(new InternetAddress(fromAddress));&lt;br /&gt;
         message.addRecipient(Message.RecipientType.TO,new InternetAddress(toAddress));&lt;br /&gt;
         message.setSubject(subj);&lt;br /&gt;
&lt;br /&gt;
         MimeBodyPart mbp1 = new MimeBodyPart();&lt;br /&gt;
&lt;br /&gt;
         mbp1.setText(content);&lt;br /&gt;
&lt;br /&gt;
         MimeBodyPart mbp2 = new MimeBodyPart();&lt;br /&gt;
&lt;br /&gt;
         FileDataSource fds = new FileDataSource(filename);&lt;br /&gt;
&lt;br /&gt;
         mbp2.setDataHandler(new DataHandler(fds));&lt;br /&gt;
         mbp2.setFileName(fds.getName());&lt;br /&gt;
&lt;br /&gt;
         Multipart mp = new MimeMultipart();&lt;br /&gt;
&lt;br /&gt;
         mp.addBodyPart(mbp1);&lt;br /&gt;
         mp.addBodyPart(mbp2);&lt;br /&gt;
&lt;br /&gt;
         message.setContent(mp);&lt;br /&gt;
         message.setSentDate(new java.util.Date());&lt;br /&gt;
&lt;br /&gt;
         Transport.send(message);&lt;br /&gt;
      } catch(Exception e) {&lt;br /&gt;
         e.printStackTrace();&lt;br /&gt;
      }&lt;br /&gt;
   }&lt;br /&gt;
}  // class MailWithAttachment&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Java]]&lt;br /&gt;
[[Category:Examples]]&lt;/div&gt;</summary>
		<author><name>PeterHarding</name></author>
	</entry>
</feed>