Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>From your code example, I can tell that you are using external <em>mail</em> program for sending emails. You create a <strong>ProcessBuilder</strong> and invoke an OS tool for sending emails.</p> <p>I would not use this solution. First, it depends on the OS (on windows you don't have the mail command). Second, this is not efficient; since you create external process for this (imagine sending many emails).</p> <p>Instead, try using existing <strong>mail</strong> solution in java (you will need: mail.jar and activation.jar). With it you can send emails directly from your application, not depending on external tool.</p> <p>While with <strong>mail</strong> Java library you can do everything you want, you may also look at <a href="http://jodd.org/doc/email.html" rel="nofollow">Jodd Email</a>. This is a small, but convenient wrapper over java mail library, that can help you with sending emails and attachments. As you can see in section '<em>Email using fluent API</em>', you can do the following:</p> <pre><code>Email email = Email.create() .from("from@foo.org") .to("to@bar.com") .subject("test") .addText("Hello!") .addHtml( "&lt;html&gt;&lt;body&gt;&lt;h1&gt;Hey!&lt;/h1&gt;" + "&lt;img src='cid:c.png'&gt;&lt;h2&gt;Hay!&lt;/h2&gt;&lt;/body&gt;&lt;/html&gt;") .embed(attachment().bytes(new File("d:\\c.png"))) .attach(attachment().file("d:\\b.jpg")); </code></pre> <p>In this example you can see two ways how you can attach your files: <em>embedding</em> them so they appear in HTML content, or common <em>attaching</em>. Of course, you don't have to use fluent interface, its just one option with this library.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload