Jenkins Cucumber report send as an Email attachment - java

I'm able to generate the HTML report for cucumber on Jenkins.But I would like to know if there is any way to convert that HTML to pdf as a post build action or send the HTML report without losing any format.
I'm able to send the HTML report to email but it's not formatted.It is missing the folder structure.
Plugin I'm using as post build action is Editable Email Notification and in Attachments I give this , js/,fonts/,embeddings/,css/* .
Any help would be greatly appreciated.

I've done this a while ago via 3th party service. You can use this htmlpdf site and send a request with form-data URL parameter (or there is stand-alone app as well) or this html2pdfrocket API.
In case you are looking just for the content as image, you can create dedicated build step using Selenium's screenshot option and add it as attachment in the email body.

Related

Jmeter File upload Scenario - Issue PUT with body

I have a jmeter scenario where I need to upload a txt file of different size . To upload the file in jmeter , we enable multipart and request is of PUT type.
I am also getting put body , which is creating issue in my log files in the backend . Posting a sample request body . Is there any way where we can just send data without any data showing up under put data .
According to your screenshot you're trying to upload a file to http://www.csm-testcenter.org/test page, the page assumes HTTP POST method, not PUT.
If you're uncertain regarding proper JMeter configuration when it comes to uploading files be informed that you can just record the file upload event using your favourite browser (or another application) and JMeter's HTTP(S) Test Script Recorder. All you need to do is to copy the file to "bin" folder of your JMeter installation, this way JMeter will be able to properly capture the request and generate the relevant HTTP Request sampler and HTTP Header Manager.
More information: Recording File Uploads with JMeter

How to embed an image in email?

I am trying to write a Java program where I need to send an image to Gmail. I am sending the image as an embedded object.
<img src="data:image/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAACcAAAAsCAYAAADmZKH2AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAABISURBVFhH7c4hAQAgEAAxEhGGZN8YOkwhTsxvnT33V+VUOVVOlVPlVDlVTpVT5VQ5VU6VU+VUOVVOlVPlVDlVTpVT5dTHubkPuMrNUFKjQWUAAAAASUVORK5CYII=">
Other mail service providers are showing it fine, but Gmail specifically is removing it, so it is not visible in the message.
How can I make it visible in Gmail as well as the other mail service providers?
Place the image in a publicly accessible server and give the url for src attribute instead of dataUrl.
It is not possible in Gmail, outlook etc. They ignore base64 images.
For further information follow the link at below.
https://www.campaignmonitor.com/blog/email-marketing/2013/02/embedded-images-in-html-email/
There is an alternative way for doing this. Embed images in the email using the cid method. (Basically including the image as an attachment, and then embedding it).
https://www.campaignmonitor.com/blog/how-to/2008/08/embedding-images-revisited/

This site can’t be reached error for Send attachments with e-mail using JSP, Servlet and JavaMail

I tried the example below. This is to Send attachments with e-mail using JSP, Servlet and JavaMail. I get This site can’t be reached error. May I know what changes are required to run this example correctly. You can directly download the war and project files from the links provided in the bottom of the page.
http://www.codejava.net/java-ee/jsp/send-attachments-with-e-mail-using-jsp-servlet-and-javamail#Download
Thanks in advance

Java - uploading to website html/js form

I'm wondering if there is any way to upload files from a java program to a website that has a simple html form.
An example could look like the one on tinypic.com or bayimg.com.
Are there any Java libraries capable of performing this? Please point me in the right direction :).
Thanks.
Mike.
HTML Form uses just HTTP POST/PUT methods to upload file to server, you don't have to work/think in this case with HTML FORM, just do HTTP Connection to script and send data in required format
Read more:
http://www.jguru.com/faq/view.jsp?EID=62798
http://www.theserverside.com/news/1365153/HttpClient-and-FileUpload
http://www.java-tips.org/other-api-tips/httpclient/how-to-use-multipart-post-method-for-uploading.html
http://www.prasannatech.net/2009/03/java-http-post-file-upload-server.html
http://www.google.cz/search?aq=f&sourceid=chrome&ie=UTF-8&q=java+http+post+upload

How to retrieve email body of any email, using Java Mail API

I am developing a Mail Client in Java (JSP and Struts). I have successfully fetched Message header information and stored in my local Database (including Message ID and subject).
When the user views the mails, I fetch the message headers from my database and display them to user. Now when the user click a particular Email, I want to fetch the mail body and file attachments from the Gmail server, directly. I don't want to serially travel through all the mails on the Gmail Server.
I have done this earlier in PHP, where if I pass the message id and I can retrieve the details of that particular mail. Is there any similar functionality in Java Mail API? If not, then can anyone suggest me a solution to this?
You can use Folder#getMessage(int) for this.
Note that the zip file with the JavaMail API which you can download from their side includes a lot of examples in /demo folder, under each a basic(!) Servlet which shows a simple mailbox with this functionality. You may want to build, refactor and expand further based on the simple example.

Categories