If you find yourself getting the following errror, when trying to send an email in Java:

com.sun.mail.smtp.SMTPSendFailedException: 550 Access denied – Invalid HELO name (See RFC2821 4.1.1.1)

Failed message 1: com.sun.mail.smtp.SMTPSendFailedException: 550 Access denied - Invalid HELO name (See RFC2821 4.1.1.1)

	at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:448)
	at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:346)
	at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:363)
	at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:351)
	at org.podcastpedia.batch.jobs.addpodcast.service.EmailNotificationServiceImpl.sendPodcastAdditionConfirmation(EmailNotificationServiceImpl.java:53)
	at org.podcastpedia.batch.jobs.addpodcast.SuggestedPodcastItemWriter.write(SuggestedPodcastItemWriter.java:50)
	at org.springframework.batch.core.step.item.SimpleChunkProcessor.writeItems(SimpleChunkProcessor.java:175)
	at org.springframework.batch.core.step.item.SimpleChunkProcessor.doWrite(SimpleChunkProcessor.java:151)
	at org.springframework.batch.core.step.item.FaultTolerantChunkProcessor$3.doWithRetry(FaultTolerantChunkProcessor.java:329)
	at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:263)
	... 43 more

and cannot figure out why does it not work?!, EVEN THOUGH you can send emails via Telnet using the same configuration as the one set up for the Java client or you set the mail.smtp.localhost property to the  fully qualified domain name (FQDN) of the client host – that might be IP address of the client host –  as suggested in the JavaMail API FAQ… THEN it might be that you are using an old version of the java mail api.

Continue Reading ...

This is a first post in a series of short code snippets that will present the configuration of Spring beans from XML to Java.

XML:

<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
  <property name="velocityProperties">
	 <value>
	  resource.loader=class
	  class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
	 </value>
  </property>
</bean>

Java:

Continue Reading ...

In this post I will present how you can format and send automatic emails with Spring and Velocity. Spring offers alone the capability to create simple text emails, which is fine for simple cases, but in typical enterprise application you wouldn’t want to do that for a number of reasons:

  • creating HTML-based email content in Java code is tedious and error prone
  • there is no clear separation between display logic and business logic
  • changing the display structure of the email requires writing Java code, recompiling, redeploying etc

Typically the approach taken to address these issues is to use a template library such as FreeMarker or Velocity to define the display structure of email content. For Podcastpedia I chose Velocity, which is a free open source Java-based templating engine from Apache. In the end my only coding task will be to create the data that is to be rendered in the email template and sending the email.

Continue Reading ...

In this post I will present how to quickly add a “Categories” entry to the menu of a WordPress standard theme. Because I am by no means an expert in WordPress and PHP yet, I wanted to avoid having to customize anything.

So here’s the trick:

In the Dashboard > Appearance > Menus section add a new entry under Links with the URL set to “#” and Link Text set to “Categories”. Once you’ve done click Add to Menu and then from Categeories pull and drop in the Menu Structure the ones you want displayed as sub-items under the newly created entry.

Continue Reading ...

Since the source code for Podcastpedia.org is now open on GitHub for everyone to have look at and contribute to, I might as well add a ribbon on the website celebrating that. After a short research on the web, I stepped over Simon Whitaker’s project github-fork-ribbon-css which I could easily integrate in  the website:

GitHub ribbon

Octocat Source code for this post is available on Github - podcastpedia.org is an open source project.

In this post I’ll present the two simple steps required for that:

Continue Reading ...