Secure SMTP Mail Writer

Name: Secure SMTP Mail Writer

Author: Ian Kerman

Version: 1.0

Created: 9/2012

Requirements: Pipeline Pilot 8.5 or later; Reporting Collection

O/S: Any

Known Limitations: None. However, this has only been tested against Google's Gmail service. If you test it with another service and find it fails, please let me know.

The following package contains a component that allows you to send e-mail through an SSL-secured connection, something not possible with the standard SMTP Mail Writer. Some services, such as Google's Gmail, require an SSL connection to send mail through their servers. With this component, you will be able to utilize these services if you have an account with them. The component is Java based and requires an extra Java library, so it has to be installed as a package. To do this, you may need to contact your server administrator.

To install:

1) Unzip the file and copy the resulting folder to /apps/

2) Run "/bin/pkgutil -i accelryssupport/securesmtpwriter"

You will now have a new component called "Secure SMTP Mail Writer" and two example protocols.

Answers 12
SB
SB 2013-10-10

It's not that you are supposed to "run" ppvars.sh but rather "source" ppvars.sh from the command line.

http://stackoverflow.com/questions/9326695/what-does-it-mean-to-source-a-file-in-unix-linux-context

Basically, it means that any environment variables set within the script stay put after the script finishes.  You can do this via either of these commands:

"source ./ppvars.sh"

or

". ./ppvars.sh"  (dot '.' is an alias for "source")

The error that you are seeing results from the environment variable LD_LIBRARY_PATH (where the system should find any dynamic .so libraries) not being set

Cheers!

JB
JB 2013-10-10

Thanks for this Ian,

I'm trying to run the pkgutil from root using

./home/accelrys/PipelinePilot85CU1/linux_bin/pkgutil -i /home/accelrys/PipelinePilot85CU1/apps/accelryssupport/securesmtpwriter

However I'm getting the error message

"./home/accelrys/PipelinePilot85CU1/linux_bin/pkgutil: error while loading shared libraries: libpilot.so: cannot open shared object file: No such file or directory"

but libpilot.so is in the linux_bin folder along with pkgutil.

I found a post that suggested that running ./ppvars.sh  before hand might help, but it hasn't.  Any suggestions?

Thanks

Joe

IK
IK 2013-10-17

Hi Joe,

I've updated the Secure SMTP Mail Writer component to now accept attachments. Again, I've only tested it with Google, but it seems to work well. You will need to reinstall the package, which you can do by using "pkgutil -r" instead of "pkgutil -i" after removing the old files and unpacking the new ones.

Regarding your observation with Office365, I think this may be related to a bug in the JavaMail library: https://jira.atlassian.com/i#browse/STASH-3482. I've upgraded the version of JavaMail that the component uses, so hopefully that will fix the issue. Please give it a try and let me know if it works. Thank you!

Ian

comment imagecomment image
JB
JB 2013-10-17

Hi Ian,

I've got this working well with our secure mail server - Thanks for your help. I also tried it on Microsoft Office365 (

http://community.office365.com/en-us/wikis/exchange/how-to-setup-an-smtp-relay-in-office-365.aspx) but couldn't seem to get it to work, not that its a problem for me.

However the secure SMTP writer doesn't allow for attachments like the unsecure SMTP writer does. Any chance of updating it to allow attachments?  Alternatively if it does allow attachments in AEP9.1 thats great, as we'll be upgrading next week.

FYI - the error with Office365 was

javax.mail.AuthenticationFailedException: No authentication mechansims supported by both server and client

java.lang.RuntimeException: javax.mail.AuthenticationFailedException: No authentication mechansims supported by both server and client

    at accelrys.Support.SSLSMTPMailWriter.SSLSMTPMailWriterComponent.onProcess(SSLSMTPMailWriterComponent.java:161)

    at com.scitegic.pilot.Pilot.callOnProcess(Pilot.java:305)

Caused by: javax.mail.AuthenticationFailedException: No authentication mechansims supported by both server and client

    at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:760)

    at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:673)

Cheers

Joe

JB
JB 2013-10-18

Thanks for the quick response Ian,

The new version worked with office365 secure SMTP at first. It also worked with my  own Secure SMTP server at first (as the last version did). However when I tried attachements it failed (error message below regarding java/nio/Paths). After this failure it can no longer authenticate with the Secure server or office 365. The error message is the:-

javax.mail.AuthenticationFailedException: No authentication mechansims supported by both server and client

I did the install with the -r rather than -i as you suggested. I simply overwrote existing files with the zip then ran -r.  After the AuthenticationFailedException I tried running the  install with the -r  again, but it doesn't recover the situation and I still get the javax.mail.AuthenticationFailedException: constantly.

So it looks like the attachments somehow kills all authentication with the Secure SMTP writer!

Attachment error below

Thanks

Joe

java/nio/file/Paths

java.lang.NoClassDefFoundError: java/nio/file/Paths

at accelrys.Support.SSLSMTPMailWriter.SSLSMTPMailWriterComponent.onProcess(SSLSMTPMailWriterComponent.java:185)

at com.scitegic.pilot.Pilot.callOnProcess(Pilot.java:305)

CComponentJavaPlugin::onProcess: Pipeline Pilot exception rethrown

-> Secure SMTP Mail Writer (Secure SMTP Mail Writer) - error during Data Record Processing phase

CProtocolStd::onProcess: Pipeline Pilot exception rethrown

CProtocol::onProcess: Pipeline Pilot exception rethrown

CComponentRunner::CallOnProcess: exception caught, calling onFinalize before rethrow

Protocol Email via SMTP, user jbradley: Pipeline Pilot exception caught

Protocol Email via SMTP, user jbradley: Protocol failed: Pipeline Pilot error

Pipeline Pilot Server version 8.5.0.200

Server OS: Linux server1.scitegrityonline.com 2.6.18-348.16.1.el5 #1 SMP Sat Jul 27 01:05:23 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux

java/nio/file/Paths

java.lang.NoClassDefFoundError: java/nio/file/Paths

at accelrys.Support.SSLSMTPMailWriter.SSLSMTPMailWriterComponent.onProcess(SSLSMTPMailWriterComponent.java:185)

at com.scitegic.pilot.Pilot.callOnProcess(Pilot.java:305)

CComponentJavaPlugin::onProcess: Pipeline Pilot exception rethrown

-> Secure SMTP Mail Writer (Secure SMTP Mail Writer) - error during Data Record Processing phase

CProtocolStd::onProcess: Pipeline Pilot exception rethrown

CProtocol::onProcess: Pipeline Pilot exception rethrown

CComponentRunner::CallOnProcess: exception caught, calling onFinalize before rethrow

Protocol Email via SMTP, user jbradley: Pipeline Pilot exception caught

Protocol Email via SMTP, user jbradley: Protocol failed: Pipeline Pilot error

Pipeline Pilot Server version 8.5.0.200

Server OS: Linux server1.scitegrityonline.com 2.6.18-348.16.1.el5 #1 SMP Sat Jul 27 01:05:23 EDT 2013 x86_64 x86_64 x86_64 GNU/Linux

IK
IK 2013-10-18

Dear Joe,

I built the class against the Java SDK in AEP 9, which is JDK1.7, but Pipeline Pilot 8.5 uses JDK1.6. In 1.7, Java introduced the "Path" class, which I used, but this isn't available in older versions. I've rewritten a version for 8.5 which uses a different method. Please install this in the same way (pkgutil -r) and hopefully this one will work for you. I've also attached the AEP 9 version explicitly marked. Have a great weekend!

Ian

comment imagecomment imagecomment imagecomment image
JB
JB 2013-10-21

Hi Ian,

The 8.5 version would not instal with -r, so I re installed via -i

The -r error was

-+ Package accelryssupport/securesmtpwriter
        Merging configuration files
        Registering Components

FAILED TO REGISTER FILE: /home/accelrys/PipelinePilot85CU1/apps/accelryssupport/securesmtpwriter/xml/Components/Data Access and Manipulation/File Writers/SecureSMTPMailWriter.xml
Duplicate component name "Secure SMTP Mail Writer" already exists at path: /home/accelrys/PipelinePilot85CU1/apps/accelryssupport/securesmtpwriter/xml/Components/Data Access and Manipulation/File Writers/SecureSMTPMailWriter.xml
        Registering Protocols

FAILED TO REGISTER FILE: /home/accelrys/PipelinePilot85CU1/apps/accelryssupport/securesmtpwriter/xml/Protocols/Examples/Generic/Secure SMTP Mail Writer/SendEmailFromGmailUsingTheSecureSMTPMailWriter.xml
Duplicate component name "Send email from Gmail using the Secure SMTP Mail Writer" already exists at path: /home/accelrys/PipelinePilot85CU1/apps/accelryssupport/securesmtpwriter/xml/Protocols/Examples/Generic/Secure SMTP Mail Writer/SendEmailFromGmailUsingTheSecureSMTPMailWriter.xml
        Unregistering Components and Protocols
        Unmerging configuration files
        Package uninstallation successful.
        There were errors registering components for accelryssupport/securesmtpwriter.


Summary:

There were errors registering the following components:

File: /home/accelrys/PipelinePilot85CU1/apps/accelryssupport/securesmtpwriter/xml/Components/Data Access and Manipulation/File Writers/SecureSMTPMailWriter.xml
ERROR:Duplicate component name "Secure SMTP Mail Writer" already exists at path: /home/accelrys/PipelinePilot85CU1/apps/accelryssupport/securesmtpwriter/xml/Components/Data Access and Manipulation/File Writers/SecureSMTPMailWriter.xml

File: /home/accelrys/PipelinePilot85CU1/apps/accelryssupport/securesmtpwriter/xml/Protocols/Examples/Generic/Secure SMTP Mail Writer/SendEmailFromGmailUsingTheSecureSMTPMailWriter.xml
ERROR:Duplicate component name "Send email from Gmail using the Secure SMTP Mail Writer" already exists at path: /home/accelrys/PipelinePilot85CU1/apps/accelryssupport/securesmtpwriter/xml/Protocols/Examples/Generic/Secure SMTP Mail Writer/SendEmailFromGmailUsingTheSecureSMTPMailWriter.xml

accelryssupport/securesmtpwriter was not installed:
        There were errors registering components for accelryssupport/securesmtpwriter.

The -i install successfully uninstalled and reinstalled, however I still get the error regarding authentication methods

javax.mail.AuthenticationFailedException: No authentication mechansims supported by both server and client

As we are upgrading to AEP 9.1 this week I'll try again with the 9.1 install, although that will probably be next week.

Cheers

Joe

JB
JB 2013-11-05

Hi Ian,

We’ve now upgraded to AEP 9.1 and the secure SMTP writer is working to a point. I can send e-mails (with the address being text, a data stream property or global variable).

However I can only send 1 defined attachment, which I have to pre-populate in the protocol before I run it, I cannot set it with a global variable or data stream property as with the non secure SMTP writer. This really limits the functionality.

For example

The non-secure mail writer logic for adding an attachment is to add the following string to the attachments box e.g

CSCS_Files/AutoAlertDocs/$(FILENAME), CSCS_Files/AutoAlertDocs/$(FILENAME2)

Where $(FILENAME) is from the property filename that’s been generated within the protocol and a file exists on the server

But this does not work in the Secure SMTP writer. I’ve also tried @FILENAME and FILENAME, but each time I get a file not found error, as it seems to interpret the variable as the filename

                java.io.FileNotFoundException: @filename (No such file or directory)

Can the writer be fixed to allow parameterisation as with the non secure SMTP writer, or am I doing something stupid?

Thanks

Joe

JB
JB 2013-11-08

Hi Ian,

I worked out how to send multiple attachments and parameterise as with the non-secure SMTP writer (after seeing Daves Hidden Tips and Tricks Webinar) making use of new AEP98.1 functionality.

For anyone interested...

To use attachments right click on 'attachments' in the parameters tag, then select 'initialise using' and select global property, data property or parent property. To attach mutliple properties select Pilotscript and enter the variables containing the paths as

@filepath.','.@filepath2

Thanks for you help and developing this secure SMTP writer with attachment

Joe

IK
IK 2014-08-01

Hi Joe,

I know there was an issue with Office 365 earlier and I fixed this in "v2" of the Writer. Is this a different issue?

Unfortunately I'm not able to look into this issue right now, but the good news is that the source code is included with the package. Once you download and unzip the package, the source code is located in \accelryssupport\securesmtpwriter\lang\java\src\accelrys\Support\SSLSMTPMailWriter\. There is one Java file in there, which you can open in your favorite IDE or text editor.

I apologize for not being able to be more active on this issue right now.

Ian

JB
JB 2014-08-01

Hi Ian,

I'm trying to use the Secure SMTP writer to send e-mail via Office365. When I used the connection information:-

SMTP host - smtp.office365.com

SMTP port -  587

I get the connection error:-

com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.1 Client was not authenticated

Even with valid credentials - I've tried a couple of accounts and its the same.

I've done some googling and found a couple of possible reasons:-

https://connect.microsoft.com/VisualStudio/feedback/details/725279/smtp-tls-authentication-usedefaultcredentials-bug-using-office365-server-as-smart-host

http://community.office365.com/en-us/f/148/t/159381.aspx

The second one suggests it because TLS is not being used, but I assume the secure SMTP writer is using this, so I wonder if its the first issue.

As I can't see the code of the writer could see if either of these are likely? I can arrange an office365 test e-mail for you if it helps

Thanks

Joe

JB
JB 2014-08-18

Thanks Ian,

I'll take a look at it sometime. For the moment I went down the path of least resistance and stuck with using a non Office365 mail server. Joe