Aggiunta invio test email con AIM
This commit is contained in:
Vendored
+1
-1
@@ -10,7 +10,7 @@ pipeline {
|
||||
steps {
|
||||
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
|
||||
script {
|
||||
withEnv(['NEXT_BUILD_NUMBER=620']) {
|
||||
withEnv(['NEXT_BUILD_NUMBER=621']) {
|
||||
// env.versionNumber = VersionNumber(versionNumberString : '3.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
|
||||
env.versionNumber = VersionNumber(versionNumberString : '3.1.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
|
||||
env.APP_NAME = 'SteamWareLib'
|
||||
|
||||
+98
-2
@@ -1,5 +1,7 @@
|
||||
using AegisImplicitMail;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
@@ -565,12 +567,101 @@ namespace SteamWare
|
||||
/// <param name="_allegati">allegati del messaggio</param>
|
||||
public bool mandaEmailNoLog(string _mailFrom, string _mailTo, string _oggetto, string _corpo, AlternateView[] _allegati)
|
||||
{
|
||||
bool answ = false;
|
||||
// sostituisco eventuali a capo nel corpo messaggio...
|
||||
_corpo = _corpo.Replace("\r", "<br />");
|
||||
_corpo = _corpo.Replace("\n", "<br />");
|
||||
//manda email...
|
||||
//_useAIMSmtp
|
||||
if (memLayer.ML.CRB("_useAIMSmtp"))
|
||||
{
|
||||
answ = sendWithAIMClient(_mailFrom, _mailTo, _oggetto, _corpo, _allegati);
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = sendWithNetClient(_mailFrom, _mailTo, _oggetto, _corpo, _allegati);
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Invia con metodo del client AIM x compatilbiiltà SSL implicito & co
|
||||
/// https://sourceforge.net/projects/netimplicitssl/
|
||||
/// </summary>
|
||||
/// <param name="_allegati"></param>
|
||||
/// <param name="messaggio"></param>
|
||||
/// <returns></returns>
|
||||
private bool sendWithAIMClient(string _mailFrom, string _mailTo, string _oggetto, string _corpo, AlternateView[] _allegati)
|
||||
{
|
||||
// Generate Message
|
||||
var mymessage = new MimeMailMessage();
|
||||
mymessage.From = new MimeMailAddress(_mailFrom);
|
||||
mymessage.To.Add(_mailTo);
|
||||
mymessage.Subject = _oggetto;
|
||||
mymessage.Body = _corpo;
|
||||
#if false
|
||||
// eventualmente aggiungo allegati...
|
||||
foreach (AlternateView allegato in _allegati)
|
||||
{
|
||||
mymessage.Attachments.Add((MimeAttachment)allegato);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Create Smtp Client
|
||||
int port = 465;
|
||||
if (memLayer.ML.CRS("_PortSSL") != "")
|
||||
{
|
||||
port = memLayer.ML.CRI("_PortSSL");
|
||||
}
|
||||
var mailer = new MimeMailer(_smtpCli, port);
|
||||
mailer.User = _username;
|
||||
mailer.Password = _password;
|
||||
if (memLayer.ML.confReadBool("_enableSSL"))
|
||||
{
|
||||
mailer.SslType = SslMode.Ssl;
|
||||
}
|
||||
mailer.AuthenticationMode = AuthenticationType.Base64;
|
||||
|
||||
//Set a delegate function for call back
|
||||
mailer.SendCompleted += compEvent;
|
||||
mailer.SendMailAsync(mymessage);
|
||||
return true;
|
||||
}
|
||||
/// <summary>
|
||||
/// CallBack chiusura invio
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void compEvent(object sender, AsyncCompletedEventArgs e)
|
||||
{
|
||||
if (e.UserState != null)
|
||||
{
|
||||
Console.Out.WriteLine(e.UserState.ToString());
|
||||
}
|
||||
|
||||
Console.Out.WriteLine("is it canceled? " + e.Cancelled);
|
||||
|
||||
if (e.Error != null)
|
||||
{
|
||||
Console.Out.WriteLine("Error : " + e.Error.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Invia con metodo del client Net standard
|
||||
/// </summary>
|
||||
/// <param name="_mailFrom">email mittente</param>
|
||||
/// <param name="_mailTo">email destinatario</param>
|
||||
/// <param name="_oggetto">oggetto dell'email</param>
|
||||
/// <param name="_corpo">corpo del messaggio</param>
|
||||
/// <param name="_allegati">allegati del messaggio</param>
|
||||
/// <returns></returns>
|
||||
private bool sendWithNetClient(string _mailFrom, string _mailTo, string _oggetto, string _corpo, AlternateView[] _allegati)
|
||||
{
|
||||
// compone messaggio
|
||||
MailMessage messaggio = new MailMessage(_mailFrom, _mailTo, _oggetto, _corpo);
|
||||
messaggio.IsBodyHtml = true;
|
||||
//manda email...
|
||||
SmtpClient _smtpClient = new SmtpClient(_smtpCli);
|
||||
// se ci sono credenziali utente...
|
||||
if (_username != "")
|
||||
@@ -605,6 +696,7 @@ namespace SteamWare
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// procedura invio email
|
||||
/// </summary>
|
||||
@@ -614,6 +706,9 @@ namespace SteamWare
|
||||
/// <param name="_corpo">corpo del messaggio</param>
|
||||
public bool mandaEmailNoLog(string _mailFrom, string _mailTo, string _oggetto, string _corpo)
|
||||
{
|
||||
// chiamo procedura con alelgati nulli...
|
||||
return mandaEmailNoLog(_mailFrom, _mailTo, _oggetto, _corpo, null);
|
||||
#if false
|
||||
// sostituisco eventuali a capo nel corpo messaggio...
|
||||
_corpo = _corpo.Replace("\r", "<br />");
|
||||
_corpo = _corpo.Replace("\n", "<br />");
|
||||
@@ -648,7 +743,8 @@ namespace SteamWare
|
||||
Console.Write("{0}", esmtp.ToString());
|
||||
logger.lg.scriviLog(string.Format("{0}\r\n full error message\r\n {1}", esmtp.Message, esmtp.ToString()), tipoLog.EXCEPTION);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
/// <summary>
|
||||
/// procedura invio email + scrittura in log!
|
||||
|
||||
Reference in New Issue
Block a user