Monday, 14 May 2018

Sending Office 365 emails with perl - invalid SSL_version

In our case, we are sending an email through Office 365 using Net::SMTP::TLS. But apparently that module is broken and unmaintained. We installed the process on a new machine and ran into the problem.

We are getting this error:

invalid SSL_version specified at C:/Strawberry/perl/vendor/lib/IO/Socket/SSL.pm line 444


We were able get it running using a different module: Net::SMTPS. The following sample code sends a email message with an attachment.




use Net::SMTPS; 
         use MIME::Entity;

my $msg = MIME::Entity->build( 
Type => 'multipart/mixed',
    From => 'Some guy <someguy@callerip.ca>',
    To => 'anotherguy@callerip.ca',
    Subject => "My subject",
);
$msg->attach(
    Type     => 'application/pdf',
    Path     => "$file",
    Filename => "attachment.pdf",
    Encoding => 'base64'
);
# send the message
        my $smtp = Net::SMTPS->new("smtp.office365.com", Port => 587, doSSL => $ssl);
  $smtp->auth ( $user, $pass);

$smtp->mail($user);

$smtp->to( $to );
# Send the message and attachments
$smtp->data(  );
$smtp->datasend([ $msg->as_string ]);
$smtp->dataend;
$smtp->quit;

Saturday, 12 May 2018

Installing MCYRPT on a php::apache docker


Trying to install MCRYPT on a php:apache docker machine?

I found this to work:
RUN apt-get install -y libmcrypt-dev libreadline-dev
RUN pecl install mcrypt-1.0.1
RUN docker-php-ext-enable mcrypt

Sunday, 22 April 2018

Specifying multiple variables using node's asterisk-ami-client library




Big thank you to the authors of the asterisk-ami-client library, providing an easy hook into asterisk from node. I found that the asterisk-ami-client library restricted me to only one variable in a custom action. To specify multiple variables in an originate command I used the following:

  client.action({
            Action: 'Originate',
            ActionID: [id],
            Channel: 'SIP/PROVIDER/' + number,
            Context: [DialplanContext],
            Exten: [extension],
            Priority: '1',
            Variable: 'someVar=' + var1 + '\r\nVariable: someVar2=' + var2 + '\r\nVariable:someVar3=' + var4,            Async: 'yes'
        });


Tuesday, 23 January 2018

Windows 10 desktop icons flickering / flashing constantly with high Explorer CPU use

Like the title says... you have a Windows 10 machine (home or pro) and the desktop icons are all flickering or flashing like mad. Task Manager shows the explorer process (explorer.exe) using a high amount of processor (CPU) usage.

There are a number of things you can try, such as disabling or removing Norton and registry hacks etc.

A quick solution that I have seen work is simply to uninstall Adobe Reader DC. It was some sort of conflict with the Edge browser. In this client's case, they had an alternate PDF solution already so we did not look deeper into how to make Adobe Reader DC work in this case. There may be a solution for that but uninstalling is a good quick way to see if that is the problem area.