There is a king, 8 bottles of wine, one of them contains poison. Who drinks the wine with poison dies after 24 hours. The king wants to figure out what is the bottle with poison in only 24 hours. Some prisoners of the kingdom are available as test drunker. You should save as much life (of the prisoners) as you can. How many tester you have to use in order to figure out what is the bottle containing wine, in 24 hours?
I had this question during the interview for a role as software engineer. You can find the solution reading the comments of this post.
lunedì, febbraio 25, 2008
martedì, febbraio 19, 2008
spring mail configuration using gmail as smtp server
If you are going to use gmail as smtp server in your spring configuration file remember to add the property mail.smtp.starttls.enable and set it to true.
Here the configuration of mailSender used in jugevents .
Fail doing it you will face into the following exception
Thanks to Lucio for the help.
Here the configuration of mailSender used in jugevents .
<!-- start mail section -->
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<!-- here your smtp server -->
<property name="host"><value>smtp.gmail.com</value></property>
<!-- Parameters for SMTP AUTH -->
<property name="username"><value>yourUsername</value></property>
<property name="password"><value>yourPassword</value></property>
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
<!-- used by gmail smtp server -->
<prop key="mail.smtp.starttls.enable">true</prop>
</props>
</property>
</bean>
Fail doing it you will face into the following exception
org.springframework.mail.MailSendException; nested exception details (1) are: Failed message 1: com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must issue a STARTTLS command first z37sm13522675ikz.1 at
Thanks to Lucio for the help.
Labels:
gmail,
mail.smtp.starttls.enable,
spring,
STARTTLS
Iscriviti a:
Post (Atom)