xarmoda
06-21-2006, 09:59 PM
Hi,
i was looking around for a php 'form mail' example that would allow punters to subscribe to my ezmlm mailinglists. i found a few pointers around the place and created this very basic form from those. note:punters will still have to respond to a confirmation message however, this safety measure can be turned off in ezmlm itself for instantanious subscription although this could easily be abused.
<?php
$from = $_POST['sAddr'];
if($_POST['action'] == 'join') {
$to='mailinglist-subscribe-'.str_replace('@','=',$from).'@domain.com';
$body = 'subscribe';
if($from != "" && $to != "") {
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: " . $from . "\n";
mail($to, $subject, $body, $headers);
print 'you will receive instructions via email on how to <b>subscribe</b> shortly.';
}
} elseif($_POST['action'] == 'leave') {
$to='mailinglist-unsubscribe-'.str_replace('@','=',$from).'@domain.com';
$body = 'unsubscribe';
if($from != "" && $to != "") {
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: " . $from . "\n";
mail($to, $subject, $body, $headers);
print 'you will receive instructions via email on how to <b>unsubscribe</b> shortly.';
}
} else {
}
?>
<form name="subscribe" method="post" action="<? echo $PHP_SELF; ?>">
subscribe:<input type="radio" name="action" value="join" checked>
unsubscribe:<input name="action" type="radio" value="leave">
email:<input name="sAddr" type="text" size="35" value=""/>
<input type="submit" value="Send Request"/>
i was looking around for a php 'form mail' example that would allow punters to subscribe to my ezmlm mailinglists. i found a few pointers around the place and created this very basic form from those. note:punters will still have to respond to a confirmation message however, this safety measure can be turned off in ezmlm itself for instantanious subscription although this could easily be abused.
<?php
$from = $_POST['sAddr'];
if($_POST['action'] == 'join') {
$to='mailinglist-subscribe-'.str_replace('@','=',$from).'@domain.com';
$body = 'subscribe';
if($from != "" && $to != "") {
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: " . $from . "\n";
mail($to, $subject, $body, $headers);
print 'you will receive instructions via email on how to <b>subscribe</b> shortly.';
}
} elseif($_POST['action'] == 'leave') {
$to='mailinglist-unsubscribe-'.str_replace('@','=',$from).'@domain.com';
$body = 'unsubscribe';
if($from != "" && $to != "") {
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: " . $from . "\n";
mail($to, $subject, $body, $headers);
print 'you will receive instructions via email on how to <b>unsubscribe</b> shortly.';
}
} else {
}
?>
<form name="subscribe" method="post" action="<? echo $PHP_SELF; ?>">
subscribe:<input type="radio" name="action" value="join" checked>
unsubscribe:<input name="action" type="radio" value="leave">
email:<input name="sAddr" type="text" size="35" value=""/>
<input type="submit" value="Send Request"/>