• Re: problem figuring out why mail fails

    From Kristall@kristallin555@gmail.com to comp.lang.php on Mon Feb 27 02:40:27 2023
    From Newsgroup: comp.lang.php

    Aitaksite mind natuke rahaga ?
    Asun M|nnnim|ne 27-39, Viljandi, EESTI RIIK.
    Telefon: (+372) 56091196
    On Friday, April 16, 2021 at 2:33:48rC>PM UTC+2, bill wrote:
    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:



    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.

    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
    --- Synchronet 3.21d-Linux NewsLink 1.2
  • From Kristall@kristallin555@gmail.com to comp.lang.php on Mon Feb 27 02:40:40 2023
    From Newsgroup: comp.lang.php

    Aitaksite mind natuke rahaga ?
    Asun M|nnnim|ne 27-39, Viljandi, EESTI RIIK.
    Telefon: (+372) 56091196
    On Wednesday, April 14, 2021 at 6:58:30rC>PM UTC+2, Jerry Stuckle wrote:
    On 4/14/2021 10:32 AM, Arno Welzel wrote:
    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
    ==================
    --- Synchronet 3.21d-Linux NewsLink 1.2