Send Mail in a job

Hi,

I work with SugarCRM pro 7.6 and I want to send a mail in one of my scheduled jobs.

I have tried to search a full example which explains how to send a mail in PHP but i can't find it.

I try the solutions in this post: https://community.sugarcrm.com/thread/28095?q=how%20to%20send%20email

But I always have errors in the log:

1-

09/07/16 13:45:08 [7536][1][FATAL] SMTP -> ERROR: Failed to connect to server. Code: 351289610 Reply: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?
09/07/16 13:45:08 [7536][1][FATAL] MailerException - @(SmtpMailer.php:166 [6]) - Failed to connect to outbound SMTP Mail Server

2-

09/07/16 14:54:54 [15560][1][FATAL] SMTP -> ERROR: Failed to connect to server. Code: 49982720 Reply: Unable to find the socket transport "ssl" - did you forget to enable it when you configured PHP?
09/07/16 14:54:54 [15560][1][FATAL] SugarPHPMailer encountered an error: SMTP Connect() failed.

PHPmailer is deprecated for 7.6 but I try it anyway, for this reason I want to use the REST /Mail service but I can't use it.

In the php.ini the ssl is enabled and if I try to send an email with the button 'Send test mail', I receive correctly the mail.

Please help me.

Best regards 

Stefano