Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 19
  1. #1
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560

    problema invio mail di conferma al mittente

    Codice PHP:
    <?php $mittente = ($_REQUEST['email']); 
    mail($mittente"E-mail inviata da: $_POST[name]""testo testo testo"); ?>
    ciao,

    l'email arriva...ma Dall'indirizzo del server (nome@linux.kolst.it)

    dovrebbe arrivare dall'indirizzo che inserisco io nel campo "email", come mai non funziona?

    grazie mille

  2. #2
    Utente di HTML.it L'avatar di Fractals87
    Registrato dal
    Apr 2008
    Messaggi
    1,202
    posta anche la form
    Che mestiere difficile.....essere da soli ancora di più

  3. #3
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    grazie

    Codice PHP:
    <?php 

    // CSS classes & styles
    $class_txt "text";
    $class_inputbutton "inputButton";
    $class_inputline "inputLine";
    $class_inputfield "inputField";
    $style_inputline "width:355px;";
    $style_inputfield "width:355px;";

    // email
    $target_address "info@sito.com";
    $email_subject "oggetto";

    // error messages
    $err_name =    "Inserisci il tuo nome.";
    $err_phone "Inserisci il tuo numero di telefono.";
    $err_msg "Please fill out the 'request' field.";
    $err_email "Inserisci un indirizzo email valido.";

    // misc text
    $msg_date "Date";
    $msg_company "Company";
    $msg_name "Name";
    $msg_address "Address";
    $msg_city "Zip/City";
    $msg_phone "Phone";
    $msg_email "Email";
    $msg_answerby "Reply by";
    $txt_email "Email";
    $txt_phone "Phone";
    $txt_post "Post";
    $txt_send "Send";
    $txt_mandatory "mandatory";
    $msg_request "Request";
    $msg_indent 11;

    // messages
    $txt_thankyou "<meta http-equiv='Refresh' content='1; URL=calc.php'>";
    $txt_error "<div style='color: #cc3300' class='$class_txt'><h2>Following errors occurred:</h2>{errors}</div>";    // {errors} is replaced by the errors that occurred



    // ### GERMAN TRANSLATION ###

    /*  

    $email_subject = "Anfrage an Dott.com";

    // error messages
    $err_name =    "Bitte Namen angeben.";
    $err_phone = "Bitte Telefon angeben.";
    $err_msg = "Formulieren Sie bitte Ihr Anliegen.";
    $err_email = "Geben Sie bitte eine g&uuml;ltige Email Adresse an.";

    // misc text
    $msg_date = "Datum";
    $msg_company = "Firma";
    $msg_name = "Name";
    $msg_address = "Adresse";
    $msg_city = "PLZ/Ort";
    $msg_phone = "Fon";
    $msg_email = "Email";
    $msg_answerby = "Antwort per";
    $txt_email = "Email";
    $txt_phone = "Telefon";
    $txt_post = "Post";
    $txt_send = "Abschicken";
    $txt_mandatory = "Pflichtfeld";
    $msg_request = "Anfrage";

    // messages
    $txt_thankyou = "<div class='$class_txt'><h2>Danke f&uuml;r Ihr Interesse!</h2>Ihre Anfrage wurde verschickt und Sie werden baldm&ouml;glichst kontaktiert werden.</div>";
    $txt_error = "<div style='color: #cc3300' class='$class_txt'><h2>Bitte beachten Sie folgendes:</h2>{errors}</div>";    // {errors} is replaced by the errors that occurred

    */


    // ################ END  CONFIG #################




    function spaces($num$fill=" "){
        
    $foo="";
        for (
    $i=0$i<$num$i++) $foo.=$fill;
        return 
    $foo;
    }

    function 
    isValidEmail($addr){
        if(
    eregi("^[a-z0-9]+([_.-][a-z0-9]+)*@([a-z0-9]+([.-][a-z0-9]+)*)+\\.[a-z]{2,4}$"$addr))
            return 
    true;
        else
            return 
    false;
    }


    // start form evaluation
    $error="foo";
    if (
    $_REQUEST['do']=="send"){
        
    $error=false;
        if (
    $_REQUEST['name']==""$error.="&raquo; $err_name
    "

        if (
    $_REQUEST['fon']==""$error.="&raquo; $err_phone
    "

        if (
    $_REQUEST['message']==""$error.="&raquo; $err_msg
    "

        if (!
    isValidEmail($_REQUEST['email'])) $error.="&raquo; $err_email
    "
    ;
        if (
    $error===false){
        
            
    $message="$msg_date:".spaces($msg_indent-strlen($msg_date)).date("d M Y, H:i"time());
            if (
    $_REQUEST['firma']) $message.="\n$msg_company:".spaces($msg_indent-strlen($msg_company)).$_REQUEST['firma'];
            if (
    $_REQUEST['name']) $message.="\n$msg_name:".spaces($msg_indent-strlen($msg_name)).$_REQUEST['name'];
            if (
    $_REQUEST['adresse']) $message.="\n$msg_address:".spaces($msg_indent-strlen($msg_address)).$_REQUEST['adresse'];
            if (
    $_REQUEST['ort']) $message.="\n$msg_city:".spaces($msg_indent-strlen($msg_city)).$_REQUEST['ort'];
            if (
    $_REQUEST['fon']) $message.="\n$msg_phone:".spaces($msg_indent-strlen($msg_phone)).$_REQUEST['fon'];
            
    $message.="\n$msg_email:".spaces($msg_indent-strlen($msg_email))."mailto:".$_REQUEST['email'];
            
    $message.="\n\n".spaces(strlen("$msg_answerby ".$_REQUEST['kontakt'])+1"=");
            
    $message.="\n$msg_answerby ".$_REQUEST['kontakt']."!\n";
            
    $message.=spaces(strlen("$msg_answerby ".$_REQUEST['kontakt'])+1"=");
            
    $message.="\n\n$msg_request:\n\n".$_REQUEST['message'];
            
            
    mail($target_address$email_subject$message"From: ".$_REQUEST['email']);
            echo 
    $txt_thankyou;
            
        }else if (
    $error!==false$error=str_replace("{errors}"$error$txt_error);

    }

    if (
    $error!==false){

        if(
    $error!="foo") echo $error;
        
        
    // form
        
    echo "<script language='JavaScript' type='text/JavaScript'>\n";
        echo 
    "window.onload = function(){ document.form1.firma.focus(); }\n";
        echo 
    "</script>\n";
        echo 
    "<form name='form1' method='post' action=''>\n";
        echo 
    "<table  border='0' cellpadding='1' cellspacing='0' class='txt'>\n";
        echo 
    "<tr><td></td>\n";
        echo 
    "<td height='19'></td></tr>\n";
        echo 
    "<tr><td width='75' class='$class_txt'>$msg_company</td>\n";
        echo 
    "<td height='19'><input name='firma' id='firma' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['firma']."'>\n";
        echo 
    "</td></tr>\n";
        echo 
    "<tr><td width='75' class='$class_txt'>$msg_name*</td>\n";
        echo 
    "<td height='19'><input name='name' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['name']."'>\n";
        echo 
    "</td></tr>\n";
        echo 
    "<tr><td width='75' class='$class_txt'>$msg_address</td>\n";
        echo 
    "<td height='19'><input name='adresse' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['adresse']."'>\n";
        echo 
    "</td></tr>\n";
        echo 
    "<tr><td width='75' class='$class_txt'>$msg_city</td>\n";
        echo 
    "<td height='19'><input name='ort' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['ort']."'>\n";
        echo 
    "</td></tr>\n";
        echo 
    "<tr><td width='75' class='$class_txt'>$msg_phone*</td>\n";
        echo 
    "<td height='19'><input name='fon' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['fon']."'>\n";
        echo 
    "</td></tr>\n";
        echo 
    "<tr><td width='75' class='$class_txt'>$msg_email*</td>\n";
        echo 
    "<td height='19'><input name='email' type='text' class='$class_inputline' style='$style_inputline' value='".$_REQUEST['email']."'>\n";
        echo 
    "</td></tr>\n";
        echo 
    "<tr><td width='75' class='$class_txt'>$msg_answerby*</td>\n";
        echo 
    "<td height='19' class='$class_txt'><input name='kontakt' type='radio' value='$txt_email' checked> $txt_email\n";
        echo 
    "<input name='kontakt' type='radio' value='$txt_phone'> $txt_phone\n";
        echo 
    "<input name='kontakt' type='radio' value='$txt_post'> $txt_post\n";
        echo 
    "</td></tr>\n";
        echo 
    "<tr><td width='75' class='$class_txt'>$msg_request*</td>\n";
        echo 
    "<td height='19'><textarea name='message' cols='45'style='$style_inputfield' rows='10' class='$class_inputfield'>".$_REQUEST['message']."</textarea></td></tr>\n";
        
        echo 
    "<tr><td width='75' ></td>\n";
        echo 
    "<td height='19' align='right'>* $txt_mandatory</td></tr>\n";

        echo 
    "<tr><td width='75'></td>\n";
        echo 
    "<td height='19'><input name='Submit' type='Submit' class='$class_inputbutton' value='$txt_send'>\n";
        echo 
    "<input name='do' type='hidden' id='do' value='send'></td>\n";
        echo 
    "</tr></table>\n";
        echo 
    "</form>\n";

    }

    ?>

  4. #4
    Utente di HTML.it L'avatar di Fractals87
    Registrato dal
    Apr 2008
    Messaggi
    1,202
    usa qesto tipo di formattazione per la mail

    Codice PHP:
    $to      'nobody@example.com';
    $subject 'the subject';
    $message 'hello';
    $headers 'From: [email]webmaster@example.com[/email]' "\r\n" .
        
    'Reply-To: [email]webmaster@example.com[/email]' "\r\n" .
        
    'X-Mailer: PHP/' phpversion();

    mail($to$subject$message$headers); 
    http://php.net/manual/en/function.mail.php
    Che mestiere difficile.....essere da soli ancora di più

  5. #5
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    grazie mille, gentilissimo

  6. #6
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    nel corpo dell'email dovrei mandare un'immagine cliccabile:

    Codice PHP:
    $message '\n [url="http://www.sito.it"][img]http://www.img.com/imm.jpg[/img][/url]'
    apro l'email con outlook e vedo solo il codice sorgente... come mai?
    grazie

  7. #7
    Utente di HTML.it L'avatar di Fractals87
    Registrato dal
    Apr 2008
    Messaggi
    1,202
    devi modificare header dicendogli che è una mail formato html

    Codice PHP:
    $header .= "MIME-Version: 1.0\n";
    $header .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
    $header .= "Content-Transfer-Encoding: 7bit\n\n"
    Che mestiere difficile.....essere da soli ancora di più

  8. #8
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    Grazie... come mai in fondo al form mi esce questa frase:

    No recipient addresses found in header

  9. #9
    Utente di HTML.it L'avatar di jcsnake
    Registrato dal
    Jun 2010
    Messaggi
    629
    Ciao, utilizza molto più semplicemente la classe PHPMailer per inviare messaggi di questo tipo, ha molte funzioni di facile utilizzo e comprensione senza dover andare a scrivere ogni volta l'header del messaggio a seconda del body che contiene. Qui trovi sorgenti e piccolo tutorial.

  10. #10
    Utente di HTML.it L'avatar di Lino80
    Registrato dal
    Oct 2005
    Messaggi
    1,560
    Ciao, grazie..il problema è che mi riesce difficile ora modificare tutto lo script.. l'errore "No recipient addresses found in header" viene fuori da qui:

    Codice PHP:
    <?php
    $to      
    $_POST['email'];
    $subject 'Richiesta';
    $message 'Gentile '.$_REQUEST['name'].' '.$_REQUEST['adresse'].', ';
    $headers 'From: [email]posta@mail.it[/email]' "\r\n" .
        
    'Reply-To: [email]posta@mail.it[/email]' "\r\n" .
        
    'X-Mailer: PHP/' phpversion();

    mail($to$subject$message$headers);
    ?>
    cosa c'è di sbagliato?

    grazie mille

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.