On Mon, Feb 13, 2017 at 7:23 AM, Markus Obermann
<[email protected]> wrote:
> Hi,and thanks.
> Well did i told i need to sent more than 1 file? :) :)So multipart/mixed is 
> what it will be in my case. i do not sent one file only.
> For me the problem is about the content-type and content-transfer-encoding.If 
> i choose a .txt file and an .xml file with smtp-sampler then i see that the 
> content-type for the .txt file is set to "text/plain" which is correct.jmeter 
> then set the content-transfer-encoding to "7bit" which is also correct. For 
> the .xml file jmeter is doing the same but with a content-type text/xml (of 
> cource)
>
> Now if i sent exactly the same two files (only files no body, no subject) 
> with thunderbird then i see that the content-type for the .txt is also 
> text/plainbut the content-transfer-encoding is "base64". And for the .xml 
> file the content-transfer-encoding is 7bit.
> i do not know how to handle it. all i can do is to sent the two files with 
> thunderbird (which is working correctly) then copy the source of that sent 
> email and save to a new file with .eml extension.then using smtp sampler to 
> sent only the .eml file. This is working properly but it makes my test very 
> static.
>
> what i tried is to set some headers but the headers will not be sent for each 
> attachment but for the email. Thus i can't set the header for each attachment 
> separetly.Its up to jmeter how it determine the content-type and which 
> content-transfer-encoding will be set.
> If if sent a .pdf it will do "base64".
> question.Is there a way i can sent 2 files with smtp sampler and send both 
> files ALWAYS with "content-transfer-encoding: base64" and of cource do a 
> "base64 filename"?

I'm not 100% sure, but your observation seems correct to me.
The SMTPSampler UI [1] doesn't seem to allow to set a content type for
each mime attachment. I guess it's detecting a content type by the
filename by the JavaMail library, and that might have affected in
attaching files. [2]
So, IMHO, you might want to try to rename the .txt file to something
else (e.g, .dat) for a luck. Or, you might want to tweak the code
(e.g, attach.setHeader("Content-Type", "application/octet-stream"))
for an experiment.
In either case, it could be very helpful if you can suggest an
enhancement with the details (e.g, experiments) in the bugzilla.

Regards,

Woonsan

[1] http://jmeter.apache.org/usermanual/component_reference.html#SMTP_Sampler
[2] 
https://github.com/apache/jmeter/blob/docs-3.1/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SendMailCommand.java#L226

> Br.Markus
>
>
>
>
>     Woonsan Ko <[email protected]> schrieb am 21:17 Mittwoch, 8.Februar 2017:
>
>
>  I haven't used SMTPSampler before, but did you read this?
> "If selected, then send the body as a plain message, i.e. not
> multipart/mixed, if possible. If the message body is empty and there
> is a single file, then send the file contents as the message body."
> [1]
> If you let it use the file as message body, I think it's proper for
> JMeter to delimit the lines by CRLF by MIME spec [2].
> By the way, I'm doubtful that JMeter handles the lower level mime
> message handling by itself. It probably has a library handle it.
>
> Regards,
>
> Woonsan
>
> [1] http://jmeter.apache.org/usermanual/component_reference.html#SMTP_Sampler
> [2] https://tools.ietf.org/html/rfc2045#section-2.10
>
>
> On Wed, Feb 8, 2017 at 11:35 AM, Markus Obermann
> <[email protected]> wrote:
>> Hello,
>> i just put some tracing on MTA and i see what jmeter is sending by doing a 
>> "hexdump -C".In fact all "LN" are sending as "0a 0d" which means CRLN :(
>> Thus the file has LN and Jmeter send it as CRLN.This makes the file invalid 
>> on my server.btw.Thunderbird is doing the same :(
>> Br.Markus
>>
>>
>>    Markus Obermann <[email protected]> schrieb am 16:29 
>> Mittwoch, 8.Februar 2017:
>>
>>
>>  Hello,
>> I'm using the latest jmeter release and latest jre on a Linux centos 
>> x64.Using the SMTP Sampler I sent one .txt file which has a size of exactly 
>> 3049 bytes.To be sure that the filesize is really 3049 bytes I have put a 
>> small PRE-beanshell sampler with this
>> File f = new File(path);long size = f.length();System.out.println("size is: 
>> " + size);
>> And in fact in the command line i can see the output "3049".
>>
>> But:Looking on my server i see that the .txt file is recieved with a size of 
>> 3087 bytes.This means that 38 bytes has been added to the filesize by the 
>> SMTP Sampler of jmeter.
>> To be fair i have to say that im using Linux and if i open the File with 
>> "vi" i get the Message "10L" which means thatthis file contain "LN" (line 
>> feed) only.
>> To be even more fair the .txt file contains 39 Lines
>> Now i think that the 38 extra bytes comes from jmeter because he read the 
>> file and do not count it as "LN" but as "CR LN".As the last line (Line 39) 
>> do _not_ have a "CR" this line is not treated as extra byte.Thus you get 38 
>> extra bytes where you have 39 lines.
>> Questions:1. Can any dev. please confirm that jmeter (or the SMTP Sampler) 
>> do read the files in as "CR LN" insted on linux you have "LN"?Means am i 
>> right with my assumption?
>> 2. How can i force jmeter to read the attachment in as "LN"? so that it 
>> sends the file with correct size?
>> 3. Feature request:Maybe it's possible to add a "checkbox" to the smtp 
>> sampler how "CR LN" should be treated for attachments.
>> In advice thanks for your answers.Br.Markus
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to