Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2006
    Messaggi
    89

    sostituire anonymous@ con email da form

    Ciao, non ho molta praticità di php; utilizzo un form mail che funziona perfettamente, unico problema è che l'email che si riceve ha come mittente anonymous@webxc12s02.ad.aruba.it. Tra i miei form ho un campo $email e vorrei poter passare questa variabile nell'header (si chiama così?) dell'email, come avviene per il subject.

    questa dvrebbe essere la parte di codice da modificare:
    Codice PHP:
    error_reporting(0);
    include(
    'contact_settings.php');
    include(
    'TemplateMailer.class.php');

    $temp = new TemplateMailer();

    function 
    daj($msg) {
        global 
    $template_folder,$temp;
        
    $temp->assign('errmsg',$msg);
        
    $temp->preparemail($template_folder 'prenota_error.tpl.html');
        die(
    $temp->body);
    }

    $reason $_POST['reason'];
    $credit $_POST['credit'];
    $numero $_POST['numero'];
    $intestatario $_POST['intestatario'];
    $scadenza $_POST['scadenza'];
    $sicurezza $_POST['sicurezza'];
    $name $_POST['name'];
    $email $_POST['email'];
    $phone $_POST['phone'];
    $company $_POST['company'];
    $uscita $_POST['uscita'];
    $subj $_POST['subject'];
    $description $_POST['text'];
    if (
    trim($description) == "") { daj("Devi inserire un messaggio."); }

    $temp->assign('reason',$reason); 
    $temp->assign('credit',$credit);
    $temp->assign('numero',$numero);
    $temp->assign('intestatario',$intestatario);
    $temp->assign('scadenza',$scadenza);
    $temp->assign('sicurezza',$sicurezza);
    $temp->assign('name',$name);
    $temp->assign('email',$email);
    $temp->assign('phone',$phone); 
    $temp->assign('uscita',$uscita);
    $temp->assign('company',$company); 
    $temp->assign('message',$description); 

    $temp->preparemail($template_folder 'prenota_mail.tpl.html');
    $adresa $reasons[$reason];

    $sent $temp->send($email,$adresa,$email_subject.' '.$subj,'');

    if (
    $sent) {
    $disya basename($_SERVER['PHP_SELF']);
    $disya str_replace('.php','.tpl.html',$disya);
    $temp->assign("template_file",$disya);
    $temp->preparemail($template_folder $disya); 
    echo 
    $temp->body;
    }
    else { 
    daj("There was an error with sending e-mail message. Please try again later!"); } 

  2. #2
    Utente di HTML.it
    Registrato dal
    Oct 2006
    Messaggi
    89
    Se aggiungo:

    Codice PHP:
    $headers "From: $name <$email>"

    e


    Codice PHP:
    $sent $temp->send($email,$adresa,$headers,$email_subject.' '.$subj,''); 
    visualizzo il nome e l'indirizzo nell'oggetto del messaggio e non nel mittente.
    Qualcuno mi sa dire il motivo?

    grazie...

  3. #3
    Utente di HTML.it
    Registrato dal
    Oct 2006
    Messaggi
    89
    RISOLTO:


    Codice PHP:
    ...
    $headers "From: ".$name." <".$email.">\r\n";
    $headers .= "Reply-To: ".$email."\r\n";
    $headers .= "Return-Path: ".$email."\r\n";
    ... 

    Codice PHP:
    ...
    $sent $temp->send($email,$adresa,$email_subject,$headers);
    ... 

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.