Also I want to add a config option mail mail_suppress_sending to inhibit sending.
The sandoz BBMB mail are sent via smtp_server: mail.ywesee.com whereas for the oddb.org we used smtp_server: smtp.gmail.com and smtp_domain: ywesee.com. The configuration item smtp_domain: bbmb.ch was missing in /var/www/sandoz.bbmb.ch/etc/config.yml.
I will use the test/util/test_mail.rb to see whether I can send real mails to my mail account. But somehow my authentication gets rejected. Why? Adapting the code as suggested in http://stackoverflow.com/questions/12884711/how-to-send-email-via-smtp-with-rubys-mail-gem helped.
Output part of a transaction shows an array instead of string. Eg. http://sandoz.xmlconv.bbmb.ngiger.ch/de/sbsm/transaction/state_id/69974110684340/transaction_id/28288
Debugging the transaction 28288 shows at line 14 lib/xmlconv/view/preformatted.rb
 pry(#<XmlConv::View::Preformatted>)> @value => "[\",4100614181,15062016,,4124733,,,1,,130620161,\\n,4100614181,15062016,,4953990,,,1,,130620161,\\n,4100614181,15062016,,5549297,,,6,,130620161,\\n,4100614181,15062016,,4714009,,,1,,130620161,\\n,4100614181,15062016,,2965693,,,1,,130620161,\\n,4100614181,15062016,,2991118,,,2,,130620161,\\n,4100614181,15062016,,3938468,,,1,,130620161,\\n,4100614181,15062016,,4714179,,,1,,130620161,\\n,4100614181,15062016,,4497463,,,2,,130620161,\\n,4100614181,15062016,,2783905,,,3,,130620161,\\n,4100614181,15062016,,6240372,,,1,,130620161,\\n,4100614181,15062016,,5552508,,,1,,130620161,\\n\"]"
I am now sure that the problem stems from the fact that the HTTP post which created this transaction generated a wrong output string. How can I change that?
Adding a join("\n") at line 33 of lib/xmlconv/util/transaction.rb did not help.
Changed mail.rb in xmlconv to resemble even more the one in bbmb. Must add the smtp-entries in /var/www/sandoz.xmlconv.bbmb.ch/etc/xmlconv.yml, too. Now the HTTP-Post spec tests passes and the output looks okay.
Pushed the following commits
Some E-Mails arrived without subject. Must fix this. The came from the polling and should have a subject of "XmlConv2 - Polling-Error". Fixed this problem with commit Fixed sending mail
Now I receive the message with subject "XmlConv2 - Polling-Error". It contains
EOFError end of file reached
I see that polling the pop server uses RMail. Polling failed because I had specied using POP+SSL instead of plain POP3 (port 110).
But xmlconv must send error messages via bbmb. But until now it has not direct dependency on bbmb. Sandoz.bbmb included bbmb and xmlconv, which share net/stmp and tmail. To make this work with the mail gem, we must configure the default delivery early (just after the bbmb gem analised the config).
Pushed commit Updated history & readme
But the XmlConv::CONFIG.mail_host is 'localhost' and on oddb-ci2 it does not accept smtp mails. But on fastpower sendmail is listening on port 25.
After emerging sendmail I get an error
Errno::ECONNRESET: Connection reset by peer. Looks like my sendmail is not yet configured correctly. Reverted to use ssmtp.
Made sending e-mails work on oddb-ci2 by specifying Mail.defaults delivery_method => :sendmail. Now sending works.
Grepping for sendmail on fastpower in /var/log/messages confirmed by suspicion, that xmlconv is really using the local SMTP port for sending messages, as I find lines like
Jun 20 16:00:02 localhost sendmail: u5KE01jQ017551: from=zdavatz, size=1272, class=0, nrcpts=1, msgid=<201606201400.u5KE01jQ017551@globopharm.xmlconv.bbmb.ch>, relay=zdavatz@localhost Jun 20 16:00:02 localhost sendmail: u5KE01jQ017551: to=root, ctladdr=zdavatz (1000/1005), delay=00:00:01, xdelay=00:00:00, mailer=relay, pri=31272, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (u5KE02Oe017558 Message accepted for delivery)
Now everything works fine locally.
Pushed commit Added possibility to send mails via sendmail