From d20ad59bd7e8cf92a67e92f1fca77e834ae02941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Thu, 16 Oct 2014 07:51:43 +0000 Subject: [PATCH] [GB.NET.SMTP] * BUG: Support multi-line greetings and mulit-line answer at authentication pass. git-svn-id: svn://localhost/gambas/trunk@6556 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- comp/src/gb.net.smtp/.icon.png | Bin 4279 -> 3484 bytes comp/src/gb.net.smtp/.src/Main.module | 46 ++++++++++----------- comp/src/gb.net.smtp/.src/SmtpClient.class | 4 +- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/comp/src/gb.net.smtp/.icon.png b/comp/src/gb.net.smtp/.icon.png index b1fb6173d42453b7ce8ed31ef5f7929b75a70bb7..4ab496eae84cda8119207b564973f241e270f282 100644 GIT binary patch delta 3445 zcmV-*4T|!&A)FhKNPi7JNkln=8tbH%6v7z>_n z$J~suEU7hRgMS(E=HFf-B8=(+f48B>&ablP+^Ml}xLe?xbM9hX;T!8_Jzjm{E0y<; zyr)Nd!C3IjxeEX=r{etHA7=y(cF4O&yD_=|KKTBH9nr;xfZ%A?M;CxxV4FzrPebQa z0UmioX0nF<)c+9&9w#JS;1MfXFN%nrD!|@_qPeV}WPfU6`9M!X!ro09aED(Pw>`G| zC$WhBqChx>i(1J^f{En<09oJm6+T;Rb|C3(5I=bBSpU^COOzRA7#5FN;>6eWvPmt4 zOles><9~A01o_g39ud~0kSVQ{Oe$T>Sjh=$0-{&}<;kR0Ql&tZATgyC@(>HF1Gb3EwzSub<43^w*}H=u;#@b+Ia=bAM{%ch*y zcYloqcEtLwlu2u$L`n-e;=yy<2-meHzCuSlNpkWOBG=qb<@J%=3qqm}?j@l0MNPWI$RKD`N=s=| zBk~}|vJv)^-EiO+y!HFv;>{&XnBU(|iI7~ou#Ri*`V!lFJ(Tq^ZW@dMA;|Q!F@L*s z3gJk}MHOJAwMl7H(vd19rJ$&Z(>LpT^qp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ov%_Rban8CenREdG@PF$g`iI)E9>8|opqXhCs<& zd=v8M31xE37%Ho)DLr|JcdvfvvX%MY`8%lTI(gacEmtxlf8nTgLYl$J$YR(mKt$+4 zUy&oTr$gcO`ndnD`*`Y?Pve<=3r^2ja=bng2^%23?`KypgygV=-G9W4I9+5JD&y;|usK-Q9V%GI=#wvVZbg-K*ZztZA+pI4pJJ z5dffsN!a1e%8$LP=uV(*kN{vcPznS9FXtbqxZdFc37`)+0sMh}0w6il763DVd>|9> zbDjOI?jq16r@bzq2{;YZ1MwkyKom)(eIzYFa({u-c@NXzRAw{EJ%tSl&UTejn|xK8n-VG9F!xiuXSJ1CE~R z!SbeJc>{R;8I+a4iWQ5olprV5&;7Sg9`)XFIjt0}-;Gc!IZ|u!FE2E(b$2_RZ7p=} ze}9smBhQaV7Z=6k!Xm0$TCuzt_)>GxiL>Nn8iarpuXRD?VH{0<;+m%kOYBRB5G8;d)`l9!Z+j+H?mp(aOqOJ(J*{S%f tIIbIG%Tu3X-A{LroqhFxuD;>%|BeP)%MkEsZ~_1T002ovPDHLkV1mrCFsJ|k diff --git a/comp/src/gb.net.smtp/.src/Main.module b/comp/src/gb.net.smtp/.src/Main.module index 003e72610..ed96a8e34 100644 --- a/comp/src/gb.net.smtp/.src/Main.module +++ b/comp/src/gb.net.smtp/.src/Main.module @@ -2,11 +2,11 @@ Public Sub Main() - ' Dim hClient As New SmtpClient - ' + Dim hClient As New SmtpClient + ' hClient.Host = "smtp.gmail.com" ' hClient.Encrypt = Net.SSL - ' hClient.User = "g4mba5@gmail.com" + ' hClient.User = "benoit.minisini@gmail.com" ' Print "Password:" ' Line Input hClient.Password ' hClient.Debug = True @@ -16,28 +16,28 @@ Public Sub Main() ' hClient.To.Add("Benoît Minisini ") ' hClient.Body = "This is a test e-mail.\nI hope it will work...\n\nIl était une fois un tout petit bébé \n=====\nJOLI HISTOIRE.\n Il y a une pièce jointe !" ' hClient.Add(File.Load("~/TexteDehorsilpleut.odt"), "application/vnd.oasis.opendocument.text", "Dehors il pleut.odt") - ' hClient.Add(File.Load("~/Zeno.png"), "image/png", "zeno.png") + ' hClient.Add(File.Load("~/balloon.png"), "image/png", "balloon.png") ' hClient.Send - Dim hMsg As New SmtpClient - - hMsg.Debug = True - hMsg.To.Add("somebody@gmail.com") - hMsg.Subject = "Test" - hMsg.Add("Something" & "\n\n" & ("-- \nPowered by ") & Application.Name & "\n") - hMsg.From = "somebody@gmail.com" - hMsg.Host = "smtp.gmail.com" - hMsg.Port = 465 - 'hMsg.User = "unknown@gmail.com" - 'hMsg.Password = "donotknow" - 'hMsg.Encrypt = Net.SSL - - Try hMsg.Send() - If Not Error Then - Print "Send successfully" - Else - Print "Send Failed: "; Error.Text - Endif + ' Dim hMsg As New SmtpClient + ' + ' hMsg.Debug = True + ' hMsg.To.Add("somebody@gmail.com") + ' hMsg.Subject = "Test" + ' hMsg.Add("Something" & "\n\n" & ("-- \nPowered by ") & Application.Name & "\n") + ' hMsg.From = "somebody@gmail.com" + ' hMsg.Host = "smtp.gmail.com" + ' hMsg.Port = 465 + ' 'hMsg.User = "unknown@gmail.com" + ' 'hMsg.Password = "donotknow" + ' 'hMsg.Encrypt = Net.SSL + ' + ' Try hMsg.Send() + ' If Not Error Then + ' Print "Send successfully" + ' Else + ' Print "Send Failed: "; Error.Text + ' Endif End diff --git a/comp/src/gb.net.smtp/.src/SmtpClient.class b/comp/src/gb.net.smtp/.src/SmtpClient.class index 34915cfa7..26679d485 100644 --- a/comp/src/gb.net.smtp/.src/SmtpClient.class +++ b/comp/src/gb.net.smtp/.src/SmtpClient.class @@ -289,7 +289,7 @@ Private Sub Connect() If $iEncrypt <> Net.TLS Then ' greetings - $hSession.GetLine() + $hSession.GetLine(True) Endif sData = $hSession.Send("EHLO " & GetDomainName(), True) @@ -310,7 +310,7 @@ Private Sub Authenticate() sData = $hSession.Send("AUTH PLAIN") If $hSession.LastCode <> "334" Then Error.Raise("Unsupported authentication method") - sData = $hSession.Send(Base64$($sUser & Chr$(0) & $sUser & Chr$(0) & $sPassword)) + sData = $hSession.Send(Base64$($sUser & Chr$(0) & $sUser & Chr$(0) & $sPassword), True) If $hSession.LastCode <> "235" Then Error.Raise("Authentication failed") Catch