광고성 이메일에 수신거부 소스를 넣고 싶은데요. 채택완료
우선 클릭해주셔서 감사합니다. 항상 sir회원님 덕분에 많은것을 알아 가네요.
이메일 수신거부 소스를 구글링해서 얻긴 했는데요. 동작이 안되서요 ㅠㅠ
ftp에 파일은
/www/mail_list 폴더를 만든후
그안에
admin_mailing.php
emails.txt
subscribe.php
이렇게 넣었습니다.
admin_mailing.php 파일 소스는
</p>
<p><?
// Some variables;
// Your emails list file;
$filelist = "emails.txt";
// Email headers that subscribed users see
// when you send them an email;
$adminmail = "webmaster@php.inc.ru";
$emailheaders = "From: " . $adminmail . "\nReply-To: " . $adminmail;
// By default we display entries;
if (!isset($mode))
$mode = "unknown";
// Since all administration is in one file,
// we choose what to to do now;
switch ($mode) {
case "create": createList(); break;
case "display": displayEntries($filelist); break;
case "add": addEntry($email); break;
case "edit": displayEditForm($id); break;
case "doEdit": editEntry($email, $oldvalue); break;
case "delete": deleteEntry($id); break;
case "send": sendNews($subject, $message); break;
default:
if (file_exists($filelist)) {
displayEntries(); displayAddEntryForm();
}</p>
<p>}</p>
<p>/* THIS IS THE PART WHERE WE CREATE A MAILING LIST FILE AUTOMATICALLY */
/* IGNORE IT IF YOU HAVE CREATED IT MANUALLY (NOTHING WILL BE DISPLAYED */
if (!file_exists($filelist)) {
echo "<h2>Please, make sure you have 777 permissions for current
directory to create the mailing list file and click the button or
create it manually and set 666 permissions on it</h2>";</p>
<p> echo "<form name=createFile action=admin_mailing.php method=post>";
echo "<input type=submit name=mode value=create mailing list file>";
echo "</form>";
exit;
}</p>
<p>function createList() {
$fp = fopen($GLOBALS["filelist"], "w");
if ($fp) {
echo "<h2>Mailing list file created successfully!</h2>";
echo "<b>" . $GLOBALS["filelist"] . "</b>";
echo "<meta http-equiv='Refresh' content='1; URL=admin_mailing.php'>";
exit;
}
else
echo "Error!";
}
/**************************************************************************/</p>
<p>
// Sends news to subscribers;
function sendNews($subject, $message) {
$filecontents = file($GLOBALS["filelist"]);
for ($i=0;$i<sizeof($filecontents);$i++) {
$a = mail($filecontents[$i], $subject, stripslashes($message), $GLOBALS["emailheaders"]);
if (!$a)
exit;
}
echo "Spam sent! ;)";
echo "<meta http-equiv='Refresh' content='1; URL=admin_mailing.php'>";
exit;
}</p>
<p>// Displays the form to add emails to list;
function displayAddEntryForm() {
echo "<h1>Add email to list:</h1>";
echo "<form name=addEntry action=admin_mailing.php method=get>";
echo "<input type=text name=email>";
echo "<input type=hidden name=mode value=add>";
echo "<input type=submit name=submit value=add>";
echo "</form>";
}</p>
<p>// Adds emails to list;
function addEntry($email) {
$fp = fopen($GLOBALS["filelist"], "a");
$emailsize = strlen($email . "\n");
$fw = fwrite($fp, $email . "\n", $emailsize);
if ($fw) {
echo "<h2><div align=center>Entry added successfully!</div></h2>";
echo "<meta http-equiv='Refresh' content='1; URL=admin_mailing.php'>";
exit;
}
else
echo "Error!";
}</p>
<p>// Displays emails from list;
// by default it display last 10 emails;
function displayEntries() {
echo "Show last <a href=admin_mailing.php?limit=10>10 emails</a> ||
<a href=admin_mailing.php?limit=20>20 emails</a> ||
<a href=admin_mailing.php?limit=50>50 emails</a> ||
<a href=admin_mailing.php?showall=>Show all</a><p>";
$filecontents = file($GLOBALS["filelist"]);
if (isset($GLOBALS["limit"]))
$limit = $GLOBALS["limit"];
if ((!isset($GLOBALS["limit"])) and (!isset($GLOBALS["showall"])))
$limit=10;
if (isset($GLOBALS["showall"])) {
for ($i=sizeof($filecontents)-1;$i>=0;$i--) {
echo $filecontents[$i] . " <a href=admin_mailing.php?mode=edit&id=" .
$filecontents[$i] . ">Edit</a> || <a href=admin_mailing.php?mode=delete&id=" .
$filecontents[$i] . ">Delete</a>
";
}
}
elseif (isset($limit)) {
$count = 1;
for ($i=sizeof($filecontents)-1;$count<=$limit;$i--) {
echo $filecontents[$i] . " <a href=admin_mailing.php?mode=edit&id=" .
$filecontents[$i] . ">Edit</a> || <a href=admin_mailing.php?mode=delete&id=" .
$filecontents[$i] . ">Delete</a>
";
$count++;
}
}</p>
<p>
}</p>
<p>// Displays the form to edit an email;
function displayEditForm($id) {
echo "<h1>Edit email:</h1>";
echo "<form name=editForm action=admin_mailing.php method=get>";
echo "<input type=text name=email value=" . $id . ">";
echo "<input type=hidden name=oldvalue value=" . $id . ">";
echo "<input type=hidden name=mode value=doEdit>";
echo "<input type=submit name=submit value=update>";
echo "</form>";
exit;
}</p>
<p>// Edits an email and writes the updated file;
function editEntry($email, $oldvalue) {
$filecontents = file($GLOBALS["filelist"]);
for ($i=0;$i<sizeof($filecontents);$i++) {
if (chop($filecontents[$i]) == $oldvalue) {
$filecontents[$i] = $email . "\n";
$fp = fopen($GLOBALS["filelist"], "w+");
for ($a=0;$a<sizeof($filecontents);$a++) {
$emailsize = strlen($filecontents[$a] . "\n");
$fw = fwrite($fp, $filecontents[$a], $emailsize);
}
echo "<h2><div align=center>Entry changed!</div></h2>";
echo "<meta http-equiv='Refresh' content='1; URL=admin_mailing.php'>";
exit;
}
}
}</p>
<p>// Deletes an email and writes an updated file;
function deleteEntry($id) {
$filecontents = file($GLOBALS["filelist"]);
for ($i=0;$i<sizeof($filecontents);$i++) {
if (chop($filecontents[$i]) == $id) {
$filecontents[$i] = "";
$fp = fopen($GLOBALS["filelist"], "w+");
for ($a=0;$a<sizeof($filecontents);$a++) {
$emailsize = strlen($filecontents[$a]);
$fw = fwrite($fp, $filecontents[$a], $emailsize);
}
echo "<h2><div align=center>Entry deleted!</div></h2>";
echo "<meta http-equiv='Refresh' content='1; URL=admin_mailing.php'>";
exit;
}
}
}</p>
<p>?>
<h2>Enter any text here that you want to send to all your subscribers:</h2>
<form name=sendEmail action=admin_mailing.php method=post>
Subject:
<input type=text name=subject>
Message body:
<textarea name=message rows=10 cols=50></textarea>
<input type=submit name=mode value=send>
</form>
이렇게 되어 있구요.
subscribe.php 파일 소스는
</p>
<p><?
/* PASTE THIS CODE SOMEWHERE IN YOUR PAGE, CHANGE FORMATTING AT YOUR PLEASURE */
// Displays the form to add emails to list;
$filelist = "emails.txt";
if (isset($email)) {
addEntry($email);
}</p>
<p>function displayAddEntryForm() {
echo "Subscribe:";
echo "<form name=addEntry action=subscribe.php method=post>";
echo "<input type=text name=email>";
echo "<input type=submit name=submit value=subscribe>";
echo "</form>";
}</p>
<p>// Adds emails to list;
function addEntry($email) {
$fp = fopen($GLOBALS["filelist"], "a");
$emailsize = strlen($email . "\n");
$fw = fwrite($fp, $email . "\n", $emailsize);
if ($fw)
echo "<h2><div align=center>You have subscribed successfully!</div></h2>";
else
echo "Error!";
}</p>
<p>displayAddEntryForm();
?>
이렇게 되어 있습니다.
테스트를 해봤는데 동작이 안되더라구요.
방법이 없을까요?
오늘도 날씨가 많이 덥네요.
더운여름철 몸 건강하시길 바랍니다.
감사합니다!
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
채택된 답변
+20 포인트
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인전체 질문 목록
답변대기
답변대기
답변대기
답변대기
답변대기
답변대기
답변대기
답변대기
채택
답변대기
답변대기
답변대기
답변대기
채택
채택
답변대기
답변대기
답변대기
채택