2017-12-17 5 views
-1

Ich habe eine Zeichenfolge wie:Wie kann ich eine Nachricht an mehr E-Mails in Strings sende

$email = '[email protected],[email protected],and [email protected]'; 
AND 
    $msg = 'SEND these to each email above thanks'; 

in meiner Leistung möchte ich in der Lage sein, Text in dem $ msg als E-Mail-Nachricht senden an jede E-Mail in $ E-Mail Beispiel:

$to = '[email protected]'; 
    $msg = 'SEND these to each email above thanks'; 
    $to = '[email protected]'; 
    $msg = 'SEND these to each email above thanks'; 
    $to = '[email protected]'; 
    $msg = 'SEND these to each email above thanks'; 



    foreach($email as $email) 
    { 
    $to = $email["to"]; 


    $subject = 'the subject'; 
    $message = '$msg'; 
    $headers = 'is this really? '; 
    mail($to, $subject, $message, $headers); 

    } 

Vielen dank für Ihre Auswirkungen in meinem soluction

+0

für einen Start "$ email" ist kein Array, verwenden Sie 'explode()', um es zu machen. – nogad

+0

@nogad Ich verstehe nicht wirklich Ihre Idee Haben Sie ein Code-Beispiel? – user9107323

Antwort

0

Try Spaltung der E-Mails String und für jede E-Mail den Code auszuführen, der die E-Mail sendet

<?php 

$emails = '[email protected],[email protected]'; 
$emailsSplitted = explode(',', $emails); 

foreach ($emailsSplitted as $email) { 
    // ... 
    // use here the variable $email to send the message 
} 
Verwandte Themen