<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Techy Things &#187; javamail</title>
	<atom:link href="https://tech.yipp.ca/category/javamail/feed/" rel="self" type="application/rss+xml" />
	<link>https://tech.yipp.ca</link>
	<description>Just another Yipp.ca Blogs site</description>
	<lastBuildDate>Thu, 01 May 2025 18:06:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.2.38</generator>
	<item>
		<title>Add timeout to java mail transport</title>
		<link>https://tech.yipp.ca/javamail/add-timeout-java-mail-transport/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=add-timeout-java-mail-transport</link>
		<comments>https://tech.yipp.ca/javamail/add-timeout-java-mail-transport/#comments</comments>
		<pubDate>Thu, 11 Dec 2014 15:52:24 +0000</pubDate>
		<dc:creator><![CDATA[frank]]></dc:creator>
				<category><![CDATA[javamail]]></category>

		<guid isPermaLink="false">http://tech.yipp.ca/?p=1345</guid>
		<description><![CDATA[<p>props.put("mail.smtp.connectiontimeout", "5000"); props.put("mail.smtp.timeout", "5000"); try { //Set the host smtp address Properties props = new Properties(); if (Integer.parseInt(port) == 465) // SSL { props.put("mail.smtp.auth", "true"); props.put("mail.smtp.socketFactory.port", port); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); props.put("mail.smtp.socketFactory.fallback", "true"); } else {&#46;&#46;&#46;</p>
<p>The post <a rel="nofollow" href="https://tech.yipp.ca/javamail/add-timeout-java-mail-transport/">Add timeout to java mail transport</a> appeared first on <a rel="nofollow" href="https://tech.yipp.ca">Techy Things</a>.</p>
]]></description>
				<content:encoded><![CDATA[<pre>                props.put("mail.smtp.connectiontimeout", "5000");
                props.put("mail.smtp.timeout", "5000");</pre>
<pre>            try
            {
                //Set the host smtp address
                Properties props = new Properties();

                if (Integer.parseInt(port) == 465) // SSL
                {
                   props.put("mail.smtp.auth", "true");
                   props.put("mail.smtp.socketFactory.port", port);
                   props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory");
                   props.put("mail.smtp.socketFactory.fallback", "true");
                }
                else
                {
                   props.put("mail.smtp.starttls.enable", "true");
                }
<span style="color: #ff6600;">
                props.put("mail.smtp.connectiontimeout", "5000");
                props.put("mail.smtp.timeout", "5000");</span>

                Session mailSession = Session.getInstance(props);
                mailSession.setDebug(false);
                Transport transport = mailSession.getTransport("smtp");
                MimeMessage message = new MimeMessage(mailSession);

                message.setSubject(subject);
                message.setContent(messageString, "text/plain");
                message.addRecipient(Message.RecipientType.TO,  new InternetAddress(recipients));
                message.setFrom(new InternetAddress(recipients));

                transport.connect(host, Integer.parseInt(port), username, password);
                transport.sendMessage(message, message.getRecipients(Message.RecipientType.TO));
                transport.close();
            } catch (Exception e)
            {
                return lastError;
            }

More info on javamail options
https://javamail.java.net/nonav/docs/api/com/sun/mail/smtp/package-summary.html</pre>
<p>The post <a rel="nofollow" href="https://tech.yipp.ca/javamail/add-timeout-java-mail-transport/">Add timeout to java mail transport</a> appeared first on <a rel="nofollow" href="https://tech.yipp.ca">Techy Things</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://tech.yipp.ca/javamail/add-timeout-java-mail-transport/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
