On 4/13/2021 4:05 PM, J.O. Aho wrote:
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:
--- Synchronet 3.21d-Linux NewsLink 1.2As 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.
Thank you to J.O Aho and Lew Pitcher and Arno Weizel and Jerry
Stuckle.
I moved the header setting out of the loop and all is good. Many
thanks.
-bill
On 4/14/2021 10:32 AM, Arno Welzel wrote:--- Synchronet 3.21d-Linux NewsLink 1.2
bill:
I have a script that sends mail in a loop. Unfortunately it is
sending only the first.
Mail returns "false" for all sends after the first:
Here is the script segment:
$to ='wil...@xxxx.com';
$subject ='IRWOM Status Update request';
$headers[] = 'MIME-Version: 1.0';
$headers[] = 'Content-type: text/html; charset=iso-8859-1';
$headers[] = 'From: mich...@xxxxx.org';
If you do this in a loop you all ADD headers with every loop cycle.
Better do this:
$headers = [
'MIME-Version: 1.0',
'Content-type: text/html; charset=iso-8859-1',
'From: mich...@xxxxx.org',
];
Or, since he's not changing the headers, just set $headers once before entering the loop. The same with $subject if that doesn't change.
--
==================
Remove the "x" from my email address
Jerry Stuckle
jstu...@attglobal.net
==================
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 65 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 10:17:02 |
| Calls: | 862 |
| Files: | 1,311 |
| D/L today: |
3 files (7,546K bytes) |
| Messages: | 265,185 |