File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -151,6 +151,26 @@ email.addAttachment("image.png", new File("./image.png"));
151151email. addAttachment(" text.txt" , new InputStream (new File (" ./file.txt" )));
152152```
153153
154+ ### Content IDs
155+
156+ ``` java
157+ // First, add an attachment
158+ email. addAttachment(" image.png" , new File (" ./image.png" ));
159+ // Map the name of the attachment to an ID
160+ email. addContentId(" image.png" , " ID_IN_HTML" )
161+ // Map the ID in the HTML
162+ email. setHtml(" <html><body>TEXT BEFORE IMAGE<img src=\" cid:ID_IN_HTML\" ></img>AFTER IMAGE</body></html>" )
163+ ```
164+
165+ ### Proxy Server Setup
166+
167+ ``` java
168+ SendGrid sendgrid = new SendGrid (" SENDGRID USERNAME" , " SENDGRID_PASSWORD" );
169+ HttpHost proxy = new HttpHost (" server" , 3128 );
170+ CloseableHttpClient http = HttpClientBuilder . create(). setProxy(proxy). setUserAgent(" sendgrid/" + sendgrid. getVersion() + " ;java" ). build();
171+ sendgrid. setClient(http);
172+ ```
173+
154174## [ X-SMTPAPI] ( http://sendgrid.com/docs/API_Reference/SMTP_API/index.html )
155175
156176The mail object extends the SMTPAPI object which is found in [ STMAPI-Java] ( https://github.com/sendgrid/smtpapi-java ) .
You can’t perform that action at this time.
0 commit comments