@@ -1144,7 +1144,7 @@ func TestClient_SetDebugLog(t *testing.T) {
11441144 return
11451145 }
11461146 }()
1147- time .Sleep (time .Millisecond * 300 )
1147+ time .Sleep (time .Millisecond * 30 )
11481148
11491149 t .Run ("SetDebugLog true" , func (t * testing.T ) {
11501150 client , err := NewClient (DefaultHost )
@@ -1536,7 +1536,7 @@ func TestClient_Close(t *testing.T) {
15361536 return
15371537 }
15381538 }()
1539- time .Sleep (time .Millisecond * 300 )
1539+ time .Sleep (time .Millisecond * 30 )
15401540
15411541 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
15421542 t .Cleanup (cancelDial )
@@ -1570,7 +1570,7 @@ func TestClient_Close(t *testing.T) {
15701570 return
15711571 }
15721572 }()
1573- time .Sleep (time .Millisecond * 300 )
1573+ time .Sleep (time .Millisecond * 30 )
15741574
15751575 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
15761576 t .Cleanup (cancelDial )
@@ -1608,7 +1608,7 @@ func TestClient_Close(t *testing.T) {
16081608 return
16091609 }
16101610 }()
1611- time .Sleep (time .Millisecond * 300 )
1611+ time .Sleep (time .Millisecond * 30 )
16121612
16131613 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
16141614 t .Cleanup (cancelDial )
@@ -1641,7 +1641,7 @@ func TestClient_DialWithContext(t *testing.T) {
16411641 return
16421642 }
16431643 }()
1644- time .Sleep (time .Millisecond * 300 )
1644+ time .Sleep (time .Millisecond * 30 )
16451645
16461646 t .Run ("connect and check connection" , func (t * testing.T ) {
16471647 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
@@ -1798,7 +1798,7 @@ func TestClient_DialWithContext(t *testing.T) {
17981798 return
17991799 }
18001800 }()
1801- time .Sleep (time .Millisecond * 300 )
1801+ time .Sleep (time .Millisecond * 30 )
18021802
18031803 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
18041804 t .Cleanup (cancelDial )
@@ -1833,7 +1833,7 @@ func TestClient_DialWithContext(t *testing.T) {
18331833 return
18341834 }
18351835 }()
1836- time .Sleep (time .Millisecond * 300 )
1836+ time .Sleep (time .Millisecond * 30 )
18371837
18381838 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
18391839 t .Cleanup (cancelDial )
@@ -1862,7 +1862,7 @@ func TestClient_DialWithContext(t *testing.T) {
18621862 return
18631863 }
18641864 }()
1865- time .Sleep (time .Millisecond * 300 )
1865+ time .Sleep (time .Millisecond * 30 )
18661866 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
18671867 t .Cleanup (cancelDial )
18681868
@@ -1892,7 +1892,7 @@ func TestClient_DialWithContext(t *testing.T) {
18921892 return
18931893 }
18941894 }()
1895- time .Sleep (time .Millisecond * 300 )
1895+ time .Sleep (time .Millisecond * 30 )
18961896 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
18971897 t .Cleanup (cancelDial )
18981898
@@ -1923,7 +1923,7 @@ func TestClient_DialWithContext(t *testing.T) {
19231923 return
19241924 }
19251925 }()
1926- time .Sleep (time .Millisecond * 300 )
1926+ time .Sleep (time .Millisecond * 30 )
19271927 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
19281928 t .Cleanup (cancelDial )
19291929
@@ -1953,7 +1953,7 @@ func TestClient_DialWithContext(t *testing.T) {
19531953 return
19541954 }
19551955 }()
1956- time .Sleep (time .Millisecond * 300 )
1956+ time .Sleep (time .Millisecond * 30 )
19571957 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
19581958 t .Cleanup (cancelDial )
19591959
@@ -1984,7 +1984,7 @@ func TestClient_DialWithContext(t *testing.T) {
19841984 return
19851985 }
19861986 }()
1987- time .Sleep (time .Millisecond * 300 )
1987+ time .Sleep (time .Millisecond * 30 )
19881988 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
19891989 t .Cleanup (cancelDial )
19901990
@@ -2017,7 +2017,7 @@ func TestClient_Reset(t *testing.T) {
20172017 return
20182018 }
20192019 }()
2020- time .Sleep (time .Millisecond * 300 )
2020+ time .Sleep (time .Millisecond * 30 )
20212021
20222022 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
20232023 t .Cleanup (cancelDial )
@@ -2050,7 +2050,7 @@ func TestClient_Reset(t *testing.T) {
20502050 return
20512051 }
20522052 }()
2053- time .Sleep (time .Millisecond * 300 )
2053+ time .Sleep (time .Millisecond * 30 )
20542054
20552055 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
20562056 t .Cleanup (cancelDial )
@@ -2085,7 +2085,7 @@ func TestClient_Reset(t *testing.T) {
20852085 return
20862086 }
20872087 }()
2088- time .Sleep (time .Millisecond * 300 )
2088+ time .Sleep (time .Millisecond * 30 )
20892089
20902090 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
20912091 t .Cleanup (cancelDial )
@@ -2125,7 +2125,7 @@ func TestClient_DialAndSendWithContext(t *testing.T) {
21252125 return
21262126 }
21272127 }()
2128- time .Sleep (time .Millisecond * 300 )
2128+ time .Sleep (time .Millisecond * 30 )
21292129
21302130 client , err := NewClient (DefaultHost , WithTLSPolicy (NoTLS ), WithPort (serverPort ))
21312131 if err != nil {
@@ -2150,7 +2150,7 @@ func TestClient_DialAndSendWithContext(t *testing.T) {
21502150 return
21512151 }
21522152 }()
2153- time .Sleep (time .Millisecond * 300 )
2153+ time .Sleep (time .Millisecond * 30 )
21542154
21552155 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
21562156 t .Cleanup (cancelDial )
@@ -2179,7 +2179,7 @@ func TestClient_DialAndSendWithContext(t *testing.T) {
21792179 return
21802180 }
21812181 }()
2182- time .Sleep (time .Millisecond * 300 )
2182+ time .Sleep (time .Millisecond * 30 )
21832183
21842184 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
21852185 t .Cleanup (cancelDial )
@@ -2208,7 +2208,7 @@ func TestClient_DialAndSendWithContext(t *testing.T) {
22082208 return
22092209 }
22102210 }()
2211- time .Sleep (time .Millisecond * 300 )
2211+ time .Sleep (time .Millisecond * 30 )
22122212
22132213 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
22142214 t .Cleanup (cancelDial )
@@ -2237,7 +2237,7 @@ func TestClient_DialAndSendWithContext(t *testing.T) {
22372237 return
22382238 }
22392239 }()
2240- time .Sleep (time .Millisecond * 300 )
2240+ time .Sleep (time .Millisecond * 30 )
22412241
22422242 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
22432243 t .Cleanup (cancelDial )
@@ -2286,7 +2286,7 @@ func TestClient_auth(t *testing.T) {
22862286 return
22872287 }
22882288 }()
2289- time .Sleep (time .Millisecond * 300 )
2289+ time .Sleep (time .Millisecond * 30 )
22902290
22912291 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
22922292 t .Cleanup (cancelDial )
@@ -2321,7 +2321,7 @@ func TestClient_auth(t *testing.T) {
23212321 return
23222322 }
23232323 }()
2324- time .Sleep (time .Millisecond * 300 )
2324+ time .Sleep (time .Millisecond * 30 )
23252325
23262326 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
23272327 t .Cleanup (cancelDial )
@@ -2351,7 +2351,7 @@ func TestClient_auth(t *testing.T) {
23512351 return
23522352 }
23532353 }()
2354- time .Sleep (time .Millisecond * 300 )
2354+ time .Sleep (time .Millisecond * 30 )
23552355
23562356 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
23572357 t .Cleanup (cancelDial )
@@ -2382,7 +2382,7 @@ func TestClient_auth(t *testing.T) {
23822382 return
23832383 }
23842384 }()
2385- time .Sleep (time .Millisecond * 300 )
2385+ time .Sleep (time .Millisecond * 30 )
23862386
23872387 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
23882388 t .Cleanup (cancelDial )
@@ -2412,7 +2412,7 @@ func TestClient_auth(t *testing.T) {
24122412 return
24132413 }
24142414 }()
2415- time .Sleep (time .Millisecond * 300 )
2415+ time .Sleep (time .Millisecond * 30 )
24162416
24172417 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
24182418 t .Cleanup (cancelDial )
@@ -2442,7 +2442,7 @@ func TestClient_auth(t *testing.T) {
24422442 return
24432443 }
24442444 }()
2445- time .Sleep (time .Millisecond * 300 )
2445+ time .Sleep (time .Millisecond * 30 )
24462446
24472447 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
24482448 t .Cleanup (cancelDial )
@@ -2476,7 +2476,7 @@ func TestClient_Send(t *testing.T) {
24762476 return
24772477 }
24782478 }()
2479- time .Sleep (time .Millisecond * 300 )
2479+ time .Sleep (time .Millisecond * 30 )
24802480
24812481 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
24822482 t .Cleanup (cancelDial )
@@ -2522,7 +2522,7 @@ func TestClient_Send(t *testing.T) {
25222522 return
25232523 }
25242524 }()
2525- time .Sleep (time .Millisecond * 300 )
2525+ time .Sleep (time .Millisecond * 30 )
25262526
25272527 ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
25282528 t .Cleanup (cancelDial )
@@ -2558,6 +2558,43 @@ func TestClient_Send(t *testing.T) {
25582558 })
25592559}
25602560
2561+ func TestClient_sendSingleMsg (t * testing.T ) {
2562+ message := testMessage (t )
2563+ t .Run ("connect and send email" , func (t * testing.T ) {
2564+ ctx , cancel := context .WithCancel (context .Background ())
2565+ defer cancel ()
2566+ PortAdder .Add (1 )
2567+ serverPort := int (TestServerPortBase + PortAdder .Load ())
2568+ featureSet := "250-8BITMIME\r \n 250-DSN\r \n 250 SMTPUTF8"
2569+ go func () {
2570+ if err := simpleSMTPServer (ctx , t , & serverProps {
2571+ FeatureSet : featureSet ,
2572+ ListenPort : serverPort ,
2573+ }); err != nil {
2574+ t .Errorf ("failed to start test server: %s" , err )
2575+ return
2576+ }
2577+ }()
2578+ time .Sleep (time .Millisecond * 30 )
2579+
2580+ ctxDial , cancelDial := context .WithTimeout (ctx , time .Millisecond * 500 )
2581+ t .Cleanup (cancelDial )
2582+
2583+ client , err := NewClient (DefaultHost , WithPort (serverPort ), WithTLSPolicy (NoTLS ))
2584+ if err = client .DialWithContext (ctxDial ); err != nil {
2585+ t .Fatalf ("failed to connect to test server: %s" , err )
2586+ }
2587+ t .Cleanup (func () {
2588+ if err := client .Close (); err != nil {
2589+ t .Errorf ("failed to close client: %s" , err )
2590+ }
2591+ })
2592+ if err = client .sendSingleMsg (message ); err != nil {
2593+ t .Errorf ("failed to send message: %s" , err )
2594+ }
2595+ })
2596+ }
2597+
25612598// TestClient_onlinetests will perform some additional tests on a actual live mail server. These tests are only
25622599// meant for the CI/CD pipeline and are usually skipped. They can be activated by setting PERFORM_ONLINE_TEST=true
25632600// in the ENV. The normal test suite should provide all the tests needed to cover the full functionality.
0 commit comments