@@ -264,7 +264,7 @@ function capabilities($ehlo_response) {
264264 function connect () {
265265 $ certfile = false ;
266266 $ certpass = false ;
267- $ result = ' An error occurred connecting to the SMTP server' ;
267+ $ result = " We couldn't connect to the email server ( SMTP). Please check your internet connection or server settings, and try again. " ;
268268 $ server = $ this ->server ;
269269
270270 if ($ this ->tls ) {
@@ -283,7 +283,7 @@ function connect() {
283283 else {
284284 $ this ->debug [] = 'Could not connect to the SMTP server ' ;
285285 $ this ->debug [] = 'fsockopen errors # ' .$ errorno .'. ' .$ errorstr ;
286- $ result = ' Could not connect to the configured SMTP server' ;
286+ $ result = " Unable to connect to the email server. Please check your internet connection or server settings, and try again. " ;
287287 }
288288 $ this ->banner = $ this ->get_response ();
289289 $ command = 'EHLO ' .$ this ->hostname ;
@@ -295,7 +295,7 @@ function connect() {
295295 $ this ->send_command ($ command );
296296 $ response = $ this ->get_response ();
297297 if ($ this ->compare_response ($ response , '220 ' ) != 0 ) {
298- $ result = ' An error occurred during the STARTTLS command ' ;
298+ $ result = " We couldn't secure the connection to the email server ( STARTTLS). Please try again later. " ;
299299 }
300300 if (isset ($ certfile ) && $ certfile ) {
301301 stream_context_set_option ($ this ->handle , 'tls ' , 'local_cert ' , $ certfile );
@@ -310,7 +310,7 @@ function connect() {
310310 $ this ->capabilities ($ response );
311311 }
312312 if ($ this ->compare_response ($ response ,'250 ' ) != 0 ) {
313- $ result = ' An error occurred during the EHLO command' ;
313+ $ result = " We couldn't complete the connection to the email server ( EHLO command fail). Please try again. " ;
314314 }
315315 else {
316316 if ($ this ->auth ) {
@@ -352,7 +352,7 @@ function authenticate($username, $password, $mech) {
352352 if ($ result ) {
353353 return 'Authentication successful ' ;
354354 }
355- return ' Authentication failed' ;
355+ return " Login to the email server failed. Please check your username and password " ;
356356 } else {
357357 switch ($ mech ) {
358358 case 'external ' :
@@ -419,13 +419,13 @@ function authenticate($username, $password, $mech) {
419419 }
420420 }
421421 if (!isset ($ result )) {
422- $ result = ' An error occurred authenticating to the SMTP server' ;
422+ $ result = " We couldn't log in to the email server. Please check your username and password. " ;
423423 $ res = $ this ->get_response ();
424424 if ($ this ->compare_response ($ res , '235 ' ) == 0 ) {
425425 $ this ->state = 'authed ' ;
426426 $ result = false ;
427427 } else {
428- $ result = ' Authorization failure ' ;
428+ $ result = " Login to the email server was not authorized. Please check your username and password, and try again. " ;
429429 if (isset ($ res [0 ][1 ])) {
430430 $ result .= ': ' .implode (' ' , $ res [0 ][1 ]);
431431 }
@@ -568,7 +568,7 @@ function send_message($from, $recipients, $message, $from_params = '', $recipien
568568 $ this ->send_command ($ command );
569569 $ res = $ this ->get_response ();
570570 $ bail = false ;
571- $ result = ' An error occurred sending the message' ;
571+ $ result = " Sorry, we couldn't send your message right now. Please, try again. " ;
572572 if (is_array ($ recipients )) {
573573 if ($ recipients_params ) {
574574 $ recipients_params = ' ' . $ recipients_params ;
@@ -598,7 +598,7 @@ function send_message($from, $recipients, $message, $from_params = '', $recipien
598598 $ this ->send_command ($ command );
599599 $ res = $ this ->get_response ();
600600 if ($ this ->compare_response ($ res , '354 ' ) != 0 ) {
601- $ result = ' An error occurred during the DATA command' ;
601+ $ result = " Sorry, we couldn't send your message right now. The server didn't accept the message for delivery. Please try again later ( DATA command failed) " ;
602602 }
603603 else {
604604 $ this ->send_command ($ message );
@@ -610,12 +610,12 @@ function send_message($from, $recipients, $message, $from_params = '', $recipien
610610 $ result = false ;
611611 }
612612 else {
613- $ result = ' An error occurred sending the message DATA ' ;
613+ $ result = " Your message could not be sent. The server did not confirm delivery. Please try again later. " ;
614614 }
615615 }
616616 }
617617 else {
618- $ result = ' An error occurred during the RCPT command ' ;
618+ $ result = " There was an error sending your message. One or more of the recipient addresses may be invalid. Please check the email addresses and try again. " ;
619619 }
620620 return $ result ;
621621 }
0 commit comments