Visualizzazione dei risultati da 1 a 2 su 2

Discussione: doppia email?

  1. #1

    doppia email?

    Salve a tutti ho questo codice php correlato a un form flash che mi permette di inviare una mail direttamente dal sito!
    Se volessi far arrivare le mail su due o più indirizzi contemporaneamente come dovrei cambiarlo?
    Grazie per l'aiuto

    <?
    if(!empty($_POST['sender_mail'])
    || !empty($_POST['sender_message'])
    || !empty($_POST['sender_subject'])
    || !empty($_POST['sender_name']))
    {
    $to = "info@latorrettadue.com"; // replace with your mail address
    $s_name = $_POST['sender_name'];
    $s_mail = $_POST['sender_mail'];
    $subject = stripslashes($_POST['sender_subject']);
    $body = stripslashes($_POST['sender_message']);
    $body .= "\n\n---------------------------\n";
    $body .= "Mail sent by: $s_name <$s_mail>\n";
    $header = "From: $s_name <$s_mail>\n";
    $header .= "Reply-To: $s_name <$s_mail>\n";
    $header .= "X-Mailer: PHP/" . phpversion() . "\n";
    $header .= "X-Priority: 1";
    if(@mail($to, $subject, $body, $header))
    {
    echo "output=sent";
    } else {
    echo "output=error";
    }
    } else {
    echo "output=error";
    }
    ?>
    Il tutto sembra sempre facile ma non è difficile!!!

  2. #2

    Re: doppia email?

    Originariamente inviato da diletta
    Salve a tutti ho questo codice php correlato a un form flash che mi permette di inviare una mail direttamente dal sito!
    Se volessi far arrivare le mail su due o più indirizzi contemporaneamente come dovrei cambiarlo?
    Grazie per l'aiuto
    Una possibile soluzione:
    Codice PHP:
    <?php 
    if(!empty($_POST['sender_mail'])
        || !empty(
    $_POST['sender_message'])
        || !empty(
    $_POST['sender_subject'])
        || !empty(
    $_POST['sender_name']))
    {
        
    $to "info@latorrettadue.com"// metti qui la prima email
        
    $to2 "miasecondaemail@latorrettadue.com"// metti qui la seconda email
        
    $s_name $_POST['sender_name'];
        
    $s_mail $_POST['sender_mail'];
        
    $subject stripslashes($_POST['sender_subject']);
        
    $body stripslashes($_POST['sender_message']);
        
    $body .= "\n\n---------------------------\n";
        
    $body .= "Mail sent by: $s_name <$s_mail>\n";
        
    $header "From: $s_name <$s_mail>\n";
        
    $header .= "Reply-To: $s_name <$s_mail>\n";
        
    $header .= "X-Mailer: PHP/" phpversion() . "\n";
        
    $header .= "X-Priority: 1";
        if(@
    mail($to$subject$body$header)) {
            echo 
    "output=sent";
            if(@
    mail($to2$subject$body$header)) {
               echo 
    "output=sent";
            } else {
               echo 
    "output=error";
            }
        } else {
            echo 
    "output=error";
        }
    } else {
        echo 
    "output=error";
    }
    ?>

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.