I want to use a port other than the default port for SMTP. Can I specify it in JavaMail?

John Zukowski

You can either set the "mail.smtp.port" property in the Properties you pass to the Session object, or specify the port when you connect in the transport:

Transport smtp = Session.getTransport("smtp");
smtp.connect(host, port, username, password);
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.