[Typo3] mail not sent through install tool

Eric Elder pokey at theranch.org
Mon Aug 1 20:58:20 CEST 2005


Just sending this note for future reference for anyone having trouble  
with the differentiated formmail extension.  I wasn't able to get the  
extension to work in my environment on 3.8.0, but I was able to write  
some HTML and PHP to work around it as an alternative.

To get it to work in typo3, I simply created a new "HTML" content  
element on a page and inserted this html code (below).  Then I put a  
PHP script on the server which is called by this form (I've included  
the php script below also).  This allows a visitor to check which of  
several newsletters they want to receive, then sends an email to the  
gnu mailman program to subscribe them.

Here's the HTML code:

**************

<form method="POST" action="http://websitename.com/subscriberanch.php">

    <div align="center">

<table border="0" cellspacing="1" cellpadding="1" class="csc-mailform">

<tr><td colspan="2" class="csc-form-commentcell"><p class="csc-form- 
label"><h3>Selected Lists:</h3></p></td></tr><tr><td class="csc-form- 
labelcell"><p class="csc-form-label"><b>Newsletter 1</b></p></td><td  
class="csc-form-fieldcell"><input type="checkbox" value="1"  
name="subscribe1" checked="checked" /></td></tr>

<tr><td class="csc-form-labelcell"><p class="csc-form- 
label"><b>Newsletter 2</b></p></td><td class="csc-form- 
fieldcell"><input type="checkbox" value="2" name="subscribe2"  
checked="checked" /></td></tr>

<tr><td class="csc-form-labelcell"><p class="csc-form- 
label"><b>Newsletter 3</b><br></p></td><td class="csc-form- 
fieldcell"><input type="checkbox" value="3" name="subscribe3"  
checked="checked" /></td></tr>

<tr><td class="csc-form-labelcell"><p class="csc-form-label- 
req">Email address:</p></td><td class="csc-form-fieldcell"><input  
type="text" name="email" size="30" value="" /></td></tr>

<tr><td class="csc-form-labelcell"><p class="csc-form-label">First  
and Last Name:</p></td><td class="csc-form-fieldcell"><input  
type="text" name="realname" size="30" value="" /></td></tr>

<tr><td class="csc-form-labelcell"><p class="csc-form- 
label">Address:</p></td><td class="csc-form-fieldcell"><input  
type="text" name="address" size="30" value="" /></td></tr>

<tr><td class="csc-form-labelcell"><p class="csc-form-label">City,  
State, ZIP:</p></td><td class="csc-form-fieldcell"><input type="text"  
name="City_State_ZIP" size="30" value="" /></td></tr>

<tr><td class="csc-form-labelcell"><p class="csc-form- 
label">Country:</p></td><td class="csc-form-fieldcell"><input  
type="text" name="Country" size="30" value="" /></td></tr>

<tr><td class="csc-form-labelcell"><p class="csc-form- 
label">Comments:</p></td><td class="csc-form-fieldcell"><textarea  
name="Comments" cols="30" rows="5" wrap="virtual">
</textarea></td></tr>

<tr><td class="csc-form-labelcell"><p class="csc-form-label"></p></ 
td><td class="csc-form-fieldcell"><input type="submit"  
name="formtype_mail" value="Sign Up!" /></td></tr></table>
     </div>
     <input type="hidden" name="a" value="subscribe">
   </form>

***************

And here's the PHP Script (subscriberanch.php):

***************
<?

if(isset($subscribe1)) { $subscribe1 = $_POST['subscribe1']; } else  
{ $subscribe1 = ""; }
if(isset($subscribe2)) { $subscribe2 = $_POST['subscribe2']; } else  
{ $subscribe2 = ""; }
if(isset($subscribe3)) { $subscribe3 = $_POST['subscribe3']; } else  
{ $subscribe3 = ""; }
if(isset($Comments)) { $Comments = $_POST['Comments']; } else  
{ $Comments = ""; }
if(isset($realname)) { $realname = $_POST['realname']; } else  
{ $realname = ""; }
if(isset($address)) { $address = $_POST['address']; } else { $address  
= ""; }
if(isset($City_State_ZIP)) { $City_State_ZIP = $_POST 
['City_State_ZIP']; } else { $City_State_ZIP = ""; }
if(isset($Country)) { $Country = $_POST['Country']; } else { $Country  
= ""; }
if(isset($a)) { $a = $_POST['a']; } else { $a = ""; }
if(isset($email)) { $email = $_POST['email']; } else { echo "You must  
provide a valid e-mail address, please go back and try again!"; }
header("Location:http://webservername.com/index.php?id=313");
?>
<?
if ($subscribe1 == "1") {
mail("newsletter1- 
$a at mailservername.com,myemailaddress at mailservername.com", "Newsletter  
1 Subscription", "newsletter1 $a \n$email \n\n$realname\n$address\n 
$City_State_ZIP\n$Country\n\n$Comments",
       "From: $email <$email>\nReply-To: $email\nX-Mailer: PHP/" .  
phpversion());
}

if ($subscribe2 == "2") {
mail("newsletter2- 
$a at mailservername.com,myemailaddress at mailservername.com", "Newsletter  
2 Subscription", "newsletter2 $a \n$email \n\n$realname\n$address\n 
$City_State_ZIP\n$Country\n\n$Comments",
       "From: $email <$email>\nReply-To: $email\nX-Mailer: PHP/" .  
phpversion());
}

if ($subscribe3 == "3") {
mail("newsletter3- 
$a at mailservername.com,myemailaddress at mailservername.com", "Newsletter  
3 Subscription", "newsletter3 $a \n$email \n\n$realname\n$address\n 
$City_State_ZIP\n$Country\n\n$Comments",
       "From: $email <$email>\nReply-To: $email\nX-Mailer: PHP/" .  
phpversion());
}
?>

**************************

A couple foonotes:  the script sends an email to the mailman program  
to sign up the person, and another email to my email address with the  
information so I can see who's signing up.  The "Location" field  
points to a thank you page already created in Typo3 that is displayed  
after a person submits the form.

Eric

On Jul 28, 2005, at 2:55 PM, Eric Elder wrote:

 > If anyone has any ideas how to get the differentiated formmail to
 > work properly again, or where to look, that would be great, or if
 >there are any alternatives to send emails to different addresses
 > based on user's selections.




More information about the TYPO3-english mailing list