smtp - JavaMail network stutter -
i've been looking @ network chatter between sample javamail send , several mail service servers , have found chatter. code sample can found on net too
package example; import java.util.properties; import javax.mail.message; import javax.mail.messagingexception; import javax.mail.session; import javax.mail.transport; import javax.mail.internet.internetaddress; import javax.mail.internet.mimemessage; public class sender { public static void main(string[] args) { properties props = new properties(); //props.put("mail.smtp.host", "localhost"); // local james props.put("mail.smtp.port", "25"); props.put("mail.smtp.from", "misterunsub@localhost"); props.put("mail.smtp.sendpartial", "false"); props.put("mail.smtp.ehlo", "false"); props.put("mail.debug", "true"); session session = session.getinstance(props,null); seek { message message = new mimemessage(session); //message.setfrom(new internetaddress("misterunsub@localhost")); message.addheader("list-unsubscribe", "<mailto:list-manager@localhost?subject=unsubscribe>"); message.setsubject("fancy mail service unsub"); message.settext("dear mail service crawler," + "\n\nno spam email, please!"); message.savechanges(); internetaddress[] alice = internetaddress.parse("alice@localhost"); transport t = session.gettransport("smtp"); t.connect(); t.sendmessage(message, alice); } grab (messagingexception e) { throw new runtimeexception(e); } } }
i've setup james on localhost receive traffic. (note james uses javamail send/forward mail service too, issue related javamail), james delegates sending javamail. , exhibits problem too. sample above sufficient prove see.
the traffic looks in wireshark
>> helo localhost << 250 localhost hello localhost (127.0.0.1 [127.0.0.1]) >> mail service from:<misterunsub@localhost> << 250 2.1.0 sender <misterunsub@localhost> ok >> rcpt to:<alice@localhost> << 250 2.1.5 recipient <alice@localhost> ok >> rset << 250 2.0.0 ok >> rset << 250 2.0.0 ok >> mail service from:<misterunsub@localhost> << 250 2.1.0 sender <misterunsub@localhost> ok >> rcpt to:<alice@localhost> << 250 2.1.5 recipient <alice@localhost> ok >> info << 354 ok send info ending <crlf>.<crlf> >> info >> . << 250 2.6.0 message recieved >> quit << 221 2.0.0 localhost service closing transmission channel
the oddity of communication first 'mail from:', 'rcpt to:', 'rset' , 'rset' rset rset causes bunch of overhead.
does know how avoid this? can confirm behavior?
update issue appears related vpn usage or loopback/localhost communication on windows. linux doesn't have issue @ all. bill shannon suggests anti-virus or firewall, might that. since anti-virus notice traffic.
thanks bill prompt replies.
javamail should not issuing rset in these cases. version of javamail using? debug output javamail show?
smtp javamail network-protocols
No comments:
Post a Comment