Additional emails are not being sent - Phpmailer - $mail->addAddress('[email protected]')

Asked

Viewed 122 times

0

Good night.

I have a somewhat curious problem. I have a client where I was hired to maintain his old site. As the same does not intend to update the site now, I’ll manage in the middle of that mess.

However, something strange happened to me: imagine that inside this site I have two files that have the function of executing the e-mail shooting. So I have, for example, the files envia_email1.php and envia_email2.php. So far all quiet. The fact is that in the archive envia_email1.php the emails are being sent normally to all recipients. Already the file envia_email2.php sends only to the recipient of which it is serving as the basis for SMTP authentication. All others are ignored.

Detail: the files are IDENTICAL. It was a Ctrl+C and Ctrl+V on the hard face. All the sending logic is similar, until the variable names I kept.

Based on this flaw, I did the following: I tried to instantiate an object for each email and it didn’t work. I changed the sending order and it didn’t work. Instead of moving to the variable, I put the emails directly in the parameter in string format ( $mail->addAddress('[email protected]'); ) and it didn’t work either.

I updated the package in Phpmailer, leaving version 5.2 and going to 6. It didn’t work either. I did the class require and then I did it with the Poser autoload: rsrsrs didn’t work either.

Anyway, the first file works normally, but the second sends only to the email that authenticates the SMTP in Phpmailer.

I come here to ask you for help! The only information I thought I might change in something was in DEBUG mode. However, I have not yet found a solution to it. Below is an example of how I am firing and, after, a picture of the debug mode as soon as the shooting is done:

// Define o remetente
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$mail->From = "[email protected]"; // Seu e-mail
$mail->Sender = "[email protected]"; // Seu e-mail
$mail->FromName = "Meu Site"; // Seu nome

// Define os destinatário(s)
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$mail->AddAddress('[email protected]');
$mail->AddAddress('[email protected]');
$mail->AddAddress('[email protected]');

Follow below DEBUG picture:

DEBUG - envia_email2.php

Anyway, I’ll be grateful if any of you know what the real problem is.

Thanks in advance!

  • They are in the same folder ? Which linux or windows hosting ? What are the file permissions? They even have the same doors and controls ?

  • Yes! All the same! 777 permission and linux hosting. Both files are in the same folder with everything identical. That’s what’s driving me crazy. Apparently there’s no reason why this isn’t working.

  • what are the ports defined for sending STMP?

  • $mail->From and $mail->Sender are identical to the authentication email?

  • @Anthraxisbr On the doors, I tested all the combinations: TLS on port 587, port 25, SSL on port 465... Gate 25 is not firing, the other two are firing normally. I tested it in both cases: in file 1 it shoots all the exhibits and in file 2 no.

  • @Wagnerfernandomomesso Yes! The host, email, password and port is the same for both cases.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.