Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "J.O. Aho" Newsgroups: comp.lang.php Subject: Re: problem figuring out why mail fails Date: Tue, 13 Apr 2021 22:05:20 +0200 Lines: 34 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: individual.net 4aE5Y/k2e0moGOnOxhKpUwbG24L9cV9xk4ABnSPk7tNq+cvBKB Cancel-Lock: sha1:6oEPaaRTSOne6MiQr9PSHx500hk= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 In-Reply-To: Content-Language: en-US-large Xref: csiph.com comp.lang.php:18607 On 13/04/2021 17.22, bill wrote: > I have a script that sends mail in a loop.  Unfortunately it is sending > only the first. > Here is the script segment: As you don't have the whole code, it's just a guess when it comes to the problem. I would guess it's your headers that grows for each mail you try to send, also simpler to use an array with named cells, see php.net documentation. > Mail returns "false" for all sends after the first: > error_get_last returns nothing rather than the array expected There ain't any direct error in the PHP code, so error_get_last will not generate anything related to this, the false just indicates that the mail server rejected your mail for an unknown reason. Also keep in mind that true don't mean that the mail was sent, just that the mail server didn't throw an error. Please do not make this as a public web page as email sending tend to be a lot more to do than use the mail-function, you need to verify that all the data is in correct format, as it's simple to make header injections and your web page would then used by spammers until your web host kicks you out after the web server appears on blacklists. Also remember to not send mail to people who hasn't agreed on getting mail from you, you may otherwise commit a crime in multiple jurisdictions. -- //Aho