changed this code:
$email_list = file("email.txt");
$soggetto="Soggetto della mail";
$destinatario = str_replace("\r\n","",$email_list);
with this:
$data = array("xxx@yyyy.it", "zzz@zzz.it");
$destinatario = str_replace("\n","",$data);
$soggetto="Soggetto della mail";
the script work good!
This is a true work code:
<?php
// formattazione HTML delle emails
$mess="<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">
<HTML><HEAD>
<META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\">
<STYLE>
H5 {text-align: justify; text-decoration: none; color: #333333; font-size: 12px; font-family: Arial}
A:link, A:visited, A:hover { color: #FFCC00 }
</STYLE>
</HEAD>
<BODY bgcolor=#FFFFFF link=#333333 alink=#333333 vlink=#333333>
<DIV><h5>Testo dell'email con tutti i tag HTML</h5>
</BODY></HTML>";
//destinatario, lettura sul TXT
$data = array("xxx@yyy.it", "zzz@zzz.it");
// anteprima testo email
if ($r1 != "si" ){
echo "anteprima newsletters<br><br>\n";
echo "$mess <br><br><br>\n
<form name=\"form1\" method=\"post\" action=\"#\">\n
<font size=\"2\" face=\"Tahoma\">Iviare emails?</font><br>\n
<font size=\"2\" face=\"Tahoma\"> \n
<input type=\"radio\" name=\"r1\" value=\"si\">\n
SI
<input type=\"submit\" name=\"Submit\" value=\"Invia emails\"></font>\n
</form>
";
}else{
//INTESTAZIONE - MITTENTE
$headers.="From: Nome mittente<info@tuosito.it>\n";
$headers.="Content-Type: text/html; charset=iso-8859-1\n";
//DESTINATARIO E SOGGETTO
$destinatario = str_replace("\n","",$data);
$soggetto="Soggetto della mail";
echo "Invio della mail ";
foreach ($data as $destinatario){
if(!(@mail($destinatario,$soggetto,$mess,$headers))){
print"<H5><b>fallito!</b><p></H5>";
}else{
echo "<font color='#000000'>eseguito correttamente! $destinatario <p>";
}
}
}
?>
how to read txt without broke script????
TXT format email:
xxx@xxx.it
yyy@yyy.it
zzz@zzz.it
insert code into txt:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>xxx</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#000000" background="image/sfondo.png" link="#FF0000" vlink="#FF0000" alink="#FF0000">
<body >
<font color="#FFFFFF" size="2" face="Tahoma">
<br></b><a href ="index.htm">Torna al menu</a><br><br>
<?php
$vai = "$email\n";
$fp = fopen ("email.txt", "a");
if ($fp){
fwrite($fp,"$vai");
fclose($fp);
echo"email copiata correttamente. <br><br>
\n
<a href=\"index.htm\">Indietro</a>";
}else{
echo"errore di scrittura!<br><br>";
}
?>
<br></b><a href ="index.htm">Torna al menu</a>
</font>
</body>
</html>
The best idea for me is make txt insede this array ..but i can't..
$data = array("xxx@xxx.it", "yyy@yyy.it", "zzz@zzz.it" ....);
help me pls! 😕