Bug 49775 - Allow sending messages without a body
Summary: Allow sending messages without a body
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: unspecified
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
Depends on:
Reported: 2010-08-18 09:02 UTC by Luciana Moreira
Modified: 2010-09-01 08:15 UTC (History)
1 user (show)

patch that allows sending messages without a body (9.51 KB, text/plain)
2010-08-18 09:04 UTC, Luciana Moreira

Note You need to log in before you can comment on or make changes to this bug.
Description Luciana Moreira 2010-08-18 09:02:21 UTC
Similar to bug 49622 I have created a patch to send messages without a body. The patch enhances the functionality of the SMTP Sampler in JMeter.

This patch is attached, and consists of a simple check box to determine if the body should be empty or not.
Comment 1 Luciana Moreira 2010-08-18 09:04:43 UTC
Created attachment 25905 [details]
patch that allows sending messages without a body
Comment 2 Sebb 2010-08-19 19:14:29 UTC
Why is the following change needed?

- attach.setDataHandler(new DataHandler(new FileDataSource(f)));
+ attach.setDataHandler(new DataHandler(new FileDataSource(f.getAbsolutePath())));
Comment 3 Sebb 2010-08-20 11:30:19 UTC
Also, I get

java.io.IOException: No content

if the message body is suppressed and there are no attached files.

Perhaps the checkbox should only be enabled if there is at least one file?
Comment 4 Sebb 2010-08-20 15:14:34 UTC
If there is no body and no files, it looks like the code needs to do the following to avoid the error:


This results in an empty body, with the headers:

MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I assume that this is what you were aiming for?


Given that it might be useful to send SMTP messages which are not multipart/mixed, maybe it would be better to change the code so that if the flag is set then the code uses:


This would only make sense if there were no files.

Though if the mailBody was emtpy, perhaps one could allow a single file and send that as the body.

If you think this makes sense, I'm happy to make the changes (i.e. no need for you to redo the patch).
Comment 5 Luciana Moreira 2010-08-25 05:46:12 UTC
Sebb this week I am quite busy, but I will do my best to get back to you on these topics next week.

Good to see that you are looking into it ;)
Comment 6 Sebb 2010-09-01 08:15:48 UTC
Applied patch to SVN with some changes as described:

URL: http://svn.apache.org/viewvc?rev=991510&view=rev
Bug 49775 - Allow sending messages without a body


Please re-open the bug if there are any issues with the changes.