-
Apache come mittente
Dopo aver appurato che sul server altervista non posso utilizzare SMTP, vorrei sapere se c'è un modo per evitare che i miei messaggi di newsletter abbiano come mittente "Apache" prima riuscivo ad impostare il mittente, ora non più....
Grrrrrrrrrr :incavolat
Sapreste aiutarmi???
Thanx
-
quando mandi una mail imposti negli header (parametro di mail) una stringa del tipo
Codice PHP:
"From: Tuonome <tuaemail@dominio.tld>"
ciao!
-
Grazie mille, ma ho già provato e non va...
Cercherò un altro modo. :=):
-
Quella stringa la devi mettere nel parametro header della funzione mail.
-
So dove metterla, ho inserito anche tutto il resto, per questo mi preoccupa il fatto che continui a risultare apache come mittente!!!
-
Magari postando il codice in discussione possiamo provare ad aiutarti...
Ciao!!!!
-
Ecco il codice, non ci capisco + niente!!!
Codice PHP:
$smarty->display('header.tpl');
if ($_POST["newsid"] != "") {
mail($_POST["to"], $lang["News at"]." ".$send->config["title"], $send->getNews($_POST["newsid"], $_POST["from"]),
$header = "Envelope-to: ".$to."\r\n";
$header .= "From: " Mionome <mionome@altervista.org>"\r\n";
$header .= "To: ".$to."\r\n";
$header .= "Subject: ".$subject."\r\n";
$header .= "Date: ".date("r")."\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: text/plain; charset=".$this->encode."\r\n";
$header .= "Content-Transfer-Encoding: 8bit\r\n";
$header .= "X-Mailer: PHP v".phpversion().$eol;
}
}
$smarty->display('send_redirect.tpl');
} else {
$smarty->display('error_emptyfields.tpl');
}
} else {
$smarty->assign('PHP_SELF', $_SERVER["PHP_SELF"]);
$smarty->assign('newsid', $_GET["newsid"]);
$smarty->display('send.tpl');
}
$smarty->display('footer.tpl');
?>
-
Ho provato a riscriverti il codice:
Codice PHP:
$smarty->display('header.tpl');
if ($_POST['newsid']!="") {
$to=$_POST['to'];
$subject=$lang["News at"]." ".$send->config["title"];
$header="Envelope-to: {$to}\r\n";
$header.="From: Mionome <mionome@altervista.org>\r\n";
$header.="To: {$to}\r\n";
$header.="Subject: {$subject}\r\n";
$header.="Date: ".date("r")."\r\n";
$header.="MIME-Version: 1.0\r\n";
$header.="Content-Type: text/plain; charset=".$this->encode."\r\n";
$header.="Content-Transfer-Encoding: 8bit\r\n";
$header.="X-Mailer: PHP v".phpversion().$eol;
mail($to,$subject,$send->getNews($_POST['newsid'],$_POST['from']),$header);
}
}
$smarty->display('send_redirect.tpl');
} else {
$smarty->display('error_emptyfields.tpl');
}
} else {
$smarty->assign('PHP_SELF', $_SERVER["PHP_SELF"]);
$smarty->assign('newsid', $_GET["newsid"]);
$smarty->display('send.tpl');
}
$smarty->display('footer.tpl');
?>
-
Scusatemi ancora, ma neppure corretto funziona...
Provo con un altro codice e mi sorge il dubbio che le impostazioni dell'apache siano in un altro file...
Lo so che sono incapace... non mi era mai successo di aver problemi :???:
Codice PHP:
<?php
require ("./global.php");
class send extends tools {
function getNews($newsid, $from) {
$query = parent::query("SELECT
n.*,
u.username
FROM nm_news n
LEFT JOIN nm_users u on n.userid=u.userid
WHERE n.newsid='".$newsid."'");
$row = parent::fetch_array($query);
$row["title"] = trim(stripslashes($row["title"]));
$row["text"] = trim(stripslashes($row["text"]));
$news_split = preg_split("/(\[more\])/", $row["text"]);
if ($row["text"] != $news_split[0]) {
$news_split[0].= $this->lang["More"]."...";
}
$row["text"] = $news_split[0];
$row["time"] = parent::format_date($row["time"]);
$row["text"] = parent::strip_bbcode($row["text"]);
$email_text .= $this->lang["You have received this message because"]." ".$from." ".$this->lang["send you this"];
$email_text .= "\n\n*** ".$row["title"]." (".$this->config["scripturl"]."/index.php?shownews=".$row["newsid"].")";
$email_text .= "\n".$row["time"]." ".$this->lang["by"]." ".$row["username"];
$email_text .= "\n\n".$row["text"]."\n";
return $email_text;
}
}
/* __MAIN__ */
$send = new send;
$smarty->display('header.tpl');
if ($_POST["newsid"] != "") {
if ($_POST["from"] != "" and $_POST["to"] != "") {
if ($send->config["smtp_enable"]) {
require ("./include/smtp.php");
$mail = new nm_smtp;
$mail->host = $send->config["smtp_host"];
$mail->user = $send->config["smtp_user"];
$mail->pass = $send->config["smtp_pass"];
$mail->from = $send->config["smtp_from"];
$mail->name = $send->config["smtp_name"];
$mail->encode = $send->lang["contenttype"];
$mail->hostname = $_SERVER["SERVER_ADDR"];
$mail->silent = true;
$mail->open();
$mail->auth();
}
if ($send->config["smtp_enable"]) {
$mail->sendmail($_POST["to"], $lang["News at"]." ".$send->config["title"], $send->getNews($_POST["newsid"], $_POST["from"]));
} else {
mail($_POST["to"], $lang["News at"]." ".$send->config["title"], $send->getNews($_POST["newsid"], $_POST["from"]), "From: ".$_POST["from"]);
}
if ($send->config["smtp_enable"]) {
$mail->quit();
}
$smarty->display('send_redirect.tpl');
} else {
$smarty->display('error_emptyfields.tpl');
}
} else {
$smarty->assign('PHP_SELF', $_SERVER["PHP_SELF"]);
$smarty->assign('newsid', $_GET["newsid"]);
$smarty->display('send.tpl');
}
$smarty->display('footer.tpl');
?>
Grazie mille
-
Prova così:
Codice PHP:
<?php
require ("./global.php");
class send extends tools {
function getNews($newsid, $from) {
$query = parent::query("SELECT
n.*,
u.username
FROM nm_news n
LEFT JOIN nm_users u on n.userid=u.userid
WHERE n.newsid='".$newsid."'");
$row = parent::fetch_array($query);
$row["title"] = trim(stripslashes($row["title"]));
$row["text"] = trim(stripslashes($row["text"]));
$news_split = preg_split("/(\[more\])/", $row["text"]);
if ($row["text"] != $news_split[0]) {
$news_split[0].= $this->lang["More"]."...";
}
$row["text"] = $news_split[0];
$row["time"] = parent::format_date($row["time"]);
$row["text"] = parent::strip_bbcode($row["text"]);
$email_text .= $this->lang["You have received this message because"]." ".$from." ".$this->lang["send you this"];
$email_text .= "\n\n*** ".$row["title"]." (".$this->config["scripturl"]."/index.php?shownews=".$row["newsid"].")";
$email_text .= "\n".$row["time"]." ".$this->lang["by"]." ".$row["username"];
$email_text .= "\n\n".$row["text"]."\n";
return $email_text;
}
}
/* __MAIN__ */
$send = new send;
$smarty->display('header.tpl');
if ($_POST["newsid"] != "") {
if ($_POST["from"] != "" and $_POST["to"] != "") {
if ($send->config["smtp_enable"]) {
require ("./include/smtp.php");
$mail = new nm_smtp;
$mail->host = $send->config["smtp_host"];
$mail->user = $send->config["smtp_user"];
$mail->pass = $send->config["smtp_pass"];
$mail->from = $send->config["smtp_from"];
$mail->name = $send->config["smtp_name"];
$mail->encode = $send->lang["contenttype"];
$mail->hostname = $_SERVER["SERVER_ADDR"];
$mail->silent = true;
$mail->open();
$mail->auth();
}
if ($send->config["smtp_enable"]) {
$mail->sendmail($_POST["to"], $lang["News at"]." ".$send->config["title"], $send->getNews($_POST["newsid"], $_POST["from"]));
} else {
$to=$_POST['to'];
$subject=$lang["News at"]." ".$send->config["title"];
$header="Envelope-to: {$to}\r\n";
$header.="From: Mionome <mionome@altervista.org>\r\n";
$header.="To: {$to}\r\n";
$header.="Subject: {$subject}\r\n";
$header.="Date: ".date("r")."\r\n";
$header.="MIME-Version: 1.0\r\n";
$header.="Content-Type: text/plain; charset=".$this->encode."\r\n";
$header.="Content-Transfer-Encoding: 8bit\r\n";
$header.="X-Mailer: PHP v".phpversion().$eol;
mail($to,$subject,$send->getNews($_POST['newsid'],$_POST['from']),$header);
}
if ($send->config["smtp_enable"]) {
$mail->quit();
}
$smarty->display('send_redirect.tpl');
} else {
$smarty->display('error_emptyfields.tpl');
}
} else {
$smarty->assign('PHP_SELF', $_SERVER["PHP_SELF"]);
$smarty->assign('newsid', $_GET["newsid"]);
$smarty->display('send.tpl');
}
$smarty->display('footer.tpl');
?>
-
Neppure così funziona, sono disperata!!! :sad: :sad: :sad: :sad:
Se qualcuno potesse contattarmi... mando lo script che ho usato per intero, è un opensource molto bello e completo, mi dispiace troppo rinunciarci!!!
Grazie ancora e scusate se rompo!!!