Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 12

Discussione: Problema Header

  1. #1
    Utente di HTML.it
    Registrato dal
    Sep 2010
    Messaggi
    107

    Problema Header

    <?php
    require("class.phpmailer.php");
    require("class.smtp.php");
    $linkrel_1 = "../collaborazione_sent.html";
    $email_from = $_POST['email'];
    $email_me = "##";
    $name = $_POST['name'];
    $telefono = $_POST['telefono'];
    $citta= $_POST['citta'];
    $indirizzo = $_POST['indirizzo'];
    $cap = $_POST['cap'];
    if ($email_from == '')
    {
    $name = $email_from;
    }

    $mail1 = new PHPMailer(true);

    $mail1->Host = "##"; // SMTP server
    $mail1->SMTPDebug = 2; // enables SMTP debug information (for testing)
    $mail1->SMTPAuth = true; // enable SMTP authentication
    $mail1->Host = "##"; // sets the SMTP server

    $mail1->Port = 26; // set the SMTP port for the GMAIL server
    $mail1->Username = "##"; // SMTP account username

    $mail1->Password = "##"; // SMTP account password
    $mail1->From = "##";
    $mail1->FromName = "##";
    $mail1->AddAddress("##");

    $mail1->WordWrap = 50;
    $mail1->AddAttachment("attach/allegato1.PDF");
    $mail1->AddAttachment("attach/allegato2.PDF");
    $mail1->AddAttachment("attach/allegato3.PDF");
    $mail1->AddAttachment("attach/allegato4.PDF");
    $mail1->AddAttachment("attach/allegato5.pdf");
    $mail1->IsHTML(true); // send as HTML
    $mail1->Subject = "Richiesta Collaborazione";
    $mail1->Body = "##";
    $mail1->AltBody = "";
    $mail1->Send();

    $mail = new PHPMailer(true);
    $mail->Host = "##"; // SMTP server
    $mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
    $mail->SMTPAuth = true; // enable SMTP authentication
    $mail->Host = "##"; // sets the SMTP server
    $mail->Port = 26; // set the SMTP port for the GMAIL server
    $mail->Username = "##"; // SMTP account username
    $mail->Password = "##"; // SMTP account password
    $mail->From = "##";
    $mail->FromName = "$name";
    $mail->AddAddress("##");

    $mail->WordWrap = 50; // set word wrap
    $mail->IsHTML(true); // send as HTML

    $mail->Subject = "##";
    $mail->Body = "Nome: $name
    Email: $email_from
    Telefono: $telefono
    Indirizzo: $indirizzo
    Citt&agrave;: $citta
    CAP: $cap";
    $mail->AltBody = "";
    $mail->Send();
    header ("Location: $linkrel_1");
    ?>

    Mi da errore sull'header: e precisamente "Cannot modify header information - headers already sent by". Pero non credo che ci sia un output.
    Come faccio per risolverlo?

    Grazie

  2. #2
    Utente di HTML.it
    Registrato dal
    Apr 2004
    Messaggi
    3,709
    controlla il file alla riga dove ti dice è iniziato l'output... cosa c'è? se poi ti dice che la riga è la numero 1 e non ci sono istruzioni che hanno un output fai sapere, che la risposta c'è

  3. #3
    Utente di HTML.it
    Registrato dal
    Sep 2010
    Messaggi
    107
    Rimanda alla riga dell'header..

  4. #4
    Utente di HTML.it
    Registrato dal
    Sep 2010
    Messaggi
    107
    Precisamente è questo l'errore:

    Warning: Cannot modify header information - headers already sent by (output started at /home/secondga/public_html/it/php/joinus.php:1) in /home/secondga/public_html/it/php/joinus.php on line 65

  5. #5
    Utente di HTML.it
    Registrato dal
    Apr 2004
    Messaggi
    3,709
    no, dice che "output started ... line 1", quindi la linea 1 è il problema... se i file inclusi non hanno problemi, verifica bene non vi siano caratteri PRIMA del tag di apertura "<?php"

  6. #6
    Utente di HTML.it
    Registrato dal
    Sep 2010
    Messaggi
    107
    Io uso dreamweaver e prima di <?php non c'e assolutamente niente.

    Per quanto riguarda i file inclusi non danno nessun problema.

    Oltretutto avevo creato anche questo script e non c'e nessun errore. Come puoi vedere sono praticamente uguali. sopratutto nell'uso della funzione header

    <?php
    $linkrel = "../altro_email_sent.html";
    $email_form = $_POST['email'];
    $email_me = "##";
    $messaggio = $_POST['mex'];
    $name = $_POST['name'];
    $telefono = $_POST['telefono'];
    if ($email_form == '')
    {
    $name = $email_form;
    }

    require("class.phpmailer.php");
    require("class.smtp.php");


    $mail = new PHPMailer(true);
    $mail->Host = "##"; // SMTP server
    $mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
    $mail->SMTPAuth = true; // enable SMTP authentication
    $mail->Host = "##"; // sets the SMTP server
    $mail->Port = 26; // set the SMTP port for the GMAIL server
    $mail->Username = "$email_me"; // SMTP account username
    $mail->Password = "##"; // SMTP account password
    $mail->From = "$email_form";
    $mail->FromName = "$name";
    $mail->AddAddress("$email_me");
    //$mail->AddAddress("altro@gmail.com"); // optional name

    $mail->WordWrap = 50; // set word wrap
    $mail->IsHTML(true); // send as HTML

    $mail->Subject = "##";
    $mail->Body = "##";
    $mail->AltBody = "";
    $mail->Send();
    header ("Location: $linkrel");
    ?>

  7. #7
    Utente di HTML.it
    Registrato dal
    Apr 2004
    Messaggi
    3,709
    prova ad aprire il file con il notepad: intanto guarda se ci sono caratteri "strani" prima del tag (posta qui ciò che osservi) e se anche non ci fosse nulla, risalva il file badando che sia impostata la modalità "ascii" puro e poi riprova.

  8. #8
    Utente di HTML.it
    Registrato dal
    Sep 2010
    Messaggi
    107
    L'ho aperto con wordpad e di caratteri prima del <?php non ce n'e neanche li.

    Come faccio ad impostare la modalità ascii con dreamweaver?

  9. #9
    Utente di HTML.it
    Registrato dal
    Apr 2004
    Messaggi
    3,709
    non wordpad, ma notepad, proprio il misero "blocco note" e poi "salva con nome" badando che vi sia codica "ANSI"

  10. #10
    Utente di HTML.it
    Registrato dal
    Sep 2010
    Messaggi
    107
    Grazie mille..funziona..

    Ma a cosa è dovuto quindi l'errore? alla codifica errata?

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.