Based on this output, the "unexpected problem" likely stems from a PHP issue related to sending HTTP headers after output has already begun.
Here's a breakdown:
SMTP Transactions Appear Successful: The SMTP communication with mail.smtp2go.com for sending emails to X...@me.com, x...@mexico.com, and xx...@demomexico.com all seem to complete successfully. The server returns 250 OK after the DATA command for each recipient, indicating the email was accepted for delivery.
PHP Warning: Headers Already Sent: The key indicator of a problem is the PHP warning:
This warning means that the PHP script tried to set or modify HTTP headers after it had already started sending output to the browser. In this case, the output seems to be the SMTP communication log itself, which PHPMailer can output for debugging purposes.
"Unexpected Problem" Correlation: The "La operación no se pudo completar debido a un problema inesperado" message likely coincides with this PHP warning. The application probably encountered an error while trying to perform a subsequent action (perhaps a redirect, setting a cookie, or some other HTTP-related task) after the email sending process, and the fact that the SMTP debug output was already sent interfered with this.
In summary, the issue isn't with the SMTP email sending itself, but rather a problem in the PHP application's execution flow where it's trying to manipulate HTTP headers after it has already started outputting content (the SMTP debug log). This typically happens when echo, print, or any other output function is called before header-related functions like header(), setcookie(), or session management functions.
To fix this, you would need to:
The "unexpected problem" message is a symptom of this incorrect order of operations in the PHP code.