Receiving Emails through SMTP BC.

As soon as you see this topic you may think that using SMTP BC you can receive emails as you receive emails in your Inbox. But the case is different here. Using SMTP BC, you can receive email which is destined for your SMTP BC and process the email based on the content.

SMTP BC is Simple Mail Transfer Protocol, which means that this is a protocol defined in RFC 821 for the mail servers defining a standard way to handle the emails. It is also a protocol for communicating with SMTP Servers for email exchanges. So, In a typical scenario when an SMTP Server receives an email it may handle in the following ways:

  •  Check if the destination email ids in the emails are bound to this SMTP Server. If so, store the emails in a location where the email clients can access it.
  •  If the destination email ids are not bound to this email address, but the SMTP Server knows how to route the email to the destination, then reroute the email to the destination.
  •  If it cannot recognize the email id defined, return an error.

Coming back to the SMTP BC case, How is it going to receive the email? Is it going to read it from a mail box? No.

 SMTP BC is implemented in such a way that it will listen in a port (default is 25) specified in the WSDL for incoming emails. That is, it has a built in SMTP Server capability to receive emails. So, what will it do receiving email? Well it just provides the email content to the consumers of the Jbi ecosystem.

As I said, an SMTP Server has to recognize the email ids mentioned in the to,cc,bcc section of an email. But how does the SMTP BC's server recognize the email ids? In a typical scenario, an SMTP Server will have a huge database of email addresses belonging to the domain. But in our case, the SMTP BC recognizes only the email ids defined in the mailto: URL of WSDL extension's smtp:server tag's location attribute.

For eg:

     <wsdl:service name="smtpWSDLService">
        <wsdl:port name="smtpWSDLPort" binding="tns:smtpWSDLBinding">
            <smtp:address location=","/>

The above WSDL defines two email ids: and In this case, the SMTP BC's smtp server can accept emails destined for only these two email ids. If you use your email client to send emails to this smtp server with to ,cc or bcc having any other email ids, the SMTP BC will reject the email.

Here are some of the scenarios I can think of where SMTP BC's inbound case can be helpful.

  1. You want to receive an email, store it somewhere and send an acknowledgement email to the sender.
  2. You want to parse an email which is in a specified format you know and process it. 
  3. Based on the subject of the email you want to organize the emails or forward it to some other email ids.

A demo:

The below demo is a simple scenario where the content and subject of an email is preserved in a file.

Here are the Steps involved:

  1. Create a BPEL Module.
  2. Create a WSDL with SMTP Binding.
  3. Create a WSDL with File Binding.
  4. Create a BPEl process.
  5. Using BPEL Designer draw the flow of activities.
  6. Create a Composite Application project.
  7. Add the Bpel Module to the Composite Application.
  8. Compile and deploy the application.
  9. Use an email client and configure the SMTP server to the SMTP BCs smtp server.
  10. Send an email with to address specified in the WSDL.

You should be able to see the file containg the subject and the content. Here is the demo:


cannot see the video on my mac, even with the latest wmv codec :( are any other formats available?

Posted by magomarcelo on October 20, 2007 at 12:57 PM IST #

SMTPBC's mini-server is not compatible with Outlook or vice versa. Using Outlook version is 2003 (11.8206.8202) SP3.

I can telnet to the server to manually test the mini-server -- this works. Its just my version of Outlook. I think it is failing on the "from" command. This might be a case of MS defining their own standards?

Posted by arwkin on May 05, 2008 at 12:15 PM IST #

Cannot play the video either. How did you create the video? That may shed some light on which type of codec you used.

Posted by mike on October 12, 2008 at 01:25 PM IST #

Post a Comment:
  • HTML Syntax: NOT allowed



« June 2016