Merge branch 'master' of gitlab.com:gambas/gambas

This commit is contained in:
gambix 2019-12-07 09:31:57 +01:00
commit 365d3e0371

View file

@ -58,6 +58,7 @@ Private $cCustomHeaders As New String[]
Private $sMessageId As String
Private $sInReplyTo As String
Private $iAuth As Integer
Private $iRemovePart As Integer
Static Public Sub _init()
@ -66,6 +67,13 @@ Static Public Sub _init()
End
'' Clear the attachments.
Public Sub Clear()
$aPart.Clear
End
Public Sub Add(Data As String, Optional MimeType As String, Name As String)
@ -251,11 +259,14 @@ Private Sub BeginSession()
'$hSession._Debug = $bDebug
$iRemovePart = 0
If $sBody Then
hPart = New SmtpPart
hPart.Data = $sBody
$aPart.Add(hPart, 0)
Inc $iRemovePart
Endif
@ -265,15 +276,25 @@ Private Sub BeginSession()
hPart.Data = "This is a MIME " & hPart.Mime & " message."
$aPart.Add(hPart, 0)
bParent = True
Inc $iRemovePart
Endif
End
Private Sub CleanUpSession()
$aPart.Remove(0, $iRemovePart)
$iRemovePart = 0
End
Private Sub EndSession()
$hSession.Send("QUIT")
$hSession.Disconnect
CleanUpSession
End
@ -524,6 +545,7 @@ Catch
sErr = Error.Text
Try $hSession.Disconnect
CleanUpSession
Error.Raise("Unable to send mail: " & sErr)
End
@ -552,7 +574,6 @@ Private Sub MessageId_Write(Value As String)
$sMessageId = Value
End
Private Function InReplyTo_Read() As String