1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
Try
'Variable pour la création du courriel
Dim smtp_svr As SmtpMail
Dim msg As New MailMessage
Dim fileAttach As MailAttachment
'Ne pas envoyer de message si no de PO non Défini ou si (line 676) le po ne contient pas de lignes, c'est simplement un po annuler mais qui sort quand meme de fdm
If InStr(m_subject, "none") = 0 And InStr(m_msg, "line 676") = 0 Then
'Définition du serveur smtp
smtp_svr.SmtpServer = smtp
'Définition du core du courriel
msg.From = m_from.Trim 'Envoyeur*****************************************
msg.BodyFormat = MailFormat.Html 'Format (txt ou html)*****************************
msg.To = m_to 'Destinataire*************************************
msg.Subject = m_subject 'Sujet********************************************
msg.Body = m_msg 'Message******************************************
msg.Priority = MailPriority.Normal 'priorité NORMAL, HIGH, LOW***********************
If m_type = 1 Then 'Pièce jointe seulement si c'est un envoi de po***
fileAttach = New MailAttachment(f_out & f_name & ".xls") 'Création d'une piece jointe**********************
msg.Attachments.Add(fileAttach) 'Ajout de la pièce jointe*************************
End If
'Envoi du courriel au destinataire
smtp_svr.Send(msg)
End If
Catch ex As Exception
fct_send_mail(envoyeur, warning, "ERREUR PO VIA MAIL " & f_name, 0, ex.ToString, "none")
'# erreur no 6
fct_exec_sql("UPDATE pur_order SET err=6 WHERE pur_order.po_number='" & f_name.Substring(3, 8) & "'")
End Try |
Partager