?
Solved

Need to use FormMail to send email but need help formatting

Posted on 2005-04-25
12
Medium Priority
?
209 Views
Last Modified: 2013-12-25
I recently ported a website from one web host provider to another.  In doing so the group email function stopped working.  After receiving help from the experts here I finally discovered that I need to use FormMail to send the emails.  I am using NMS FormMail Version 3.14c1.  My problem now is that I don't know how to set it up so I can send to multiple receipients.  I have a form that the user chooses which group to send the email to.  The original code then would go out and read the email addresses from a database based on the members of the group.  The sending of the email was done right from the .ASP code.  Now that I have to use FormMail, I don't know how to set up the form to allow for multiple receipients.  Any help would be greatly appreciated.  I don't know Perl but I can get a reference book.
0
Comment
Question by:dyarosh
  • 6
  • 5
11 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13860048
the user simply has to key in multiple adresses seperated by , (colon). That should do the trick.

But keep in mind that someone might use your script for mass-mailings .. take care.
0
 

Author Comment

by:dyarosh
ID: 13860625
The problem is the user simply selects a group from a list.  They don't have to key in the addresses at all.  The code then takes the list chosen and pulls out the emails from a database.  Now I can use a onsubmit function to pull out the addresses and create a string with the email addresses and set the recipient field in the form to the string but how do I handle the allow_mail_to in the MailForm.pl?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13862364
> ..  user simply selects a group from a list.
good solution (if you think secure too;-)

> .. takes the list chosen and pulls out the emails from a database.
this happens on your server in FormMail.cgi, so simply send the email to each of the "pulled" addresses.
Or do I miss something here?
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 

Author Comment

by:dyarosh
ID: 13863064
Let me be more clear.  The form looks like this:

Group to send to: (pull down menu with the following options - All Members, Board, Activities, Music, plus many more)

Subject:

Message:


When the user selects Board for example, the original code went to the database and pulled out all members who belonged to the Board group and pulled their email ids.  It then used something like CDO to send the email after formatting the message.  I can't use CDO according to my web hosting provider.  I have to use FormMail.  So now that I have FormMail.pl in my cgi_bin directory I'm trying to get it to work with FormMail.  If I understand your comment, your saying I can access the database in the Perl script and pull out the emails there?  If that is correct can you give me a good website to look at for similar code examples or a good book to buy?  I do not know Perl.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13864697
could you please post the HTML code of the FORM
0
 

Author Comment

by:dyarosh
ID: 13865964
Here is the HTML code for the form.

<form action="../cgi_bin/FormMail.pl" method="POST" name="frmEmailGroup" >
 <input type="hidden" name="recipient" value="user@domain.tld" />
 <input type="hidden" name="email" value=<% Response.Write strSenderEmail %> />
 <input type="hidden" name="redirect" value="http://domain.tld/manage/emailGroup.asp" />

<table border="0" cellspacing="0" cellpadding="5">
 <tr align="left" valign="top" class="regTextBlack">
  <td><strong>Recipient Group :</strong></td>
  <td><select name="commRecipient" id="commRecipient" class="textEntryBox">
    <option value="-1"<% If  recipientGroup = "" or recipientGroup = -1 Then %> selected<% End If %>> Please Select a Group</option>
    <option value="0"<% If  recipientGroup = "0" Then %> selected<% End If %>>The Board</option>
    <option value="all"<% If  recipientGroup = "all" Then %> selected<% End If %>>All Members</option>
    <option value=""></option>
    <% For i = 0 to uBound(arrComm,2) %>
      <option value="<%= arrComm(0,i) %>"<% If recipientGroup = cStr(arrComm(0,i)) Then %> selected<% End If %>><%= arrComm(1,i) %></option>
    <% Next %>
   </select></td>
  </tr>
  <tr align="left" valign="top" class="regTextBlack">
   <td><strong>Subject :</strong> </td>
   <td><input name="subject" type="text" class="textEntryBox" value="<%=strSubject%>" size="39"></td>
  </tr>
  <tr align="left" valign="top" class="regTextBlack">
   <td><strong>Message :</strong> </td>
   <td><textarea name="Message" cols="38" rows="5" class="textEntryBox"><%=strMessage%></textarea></td>
  </tr>
  <tr align="left" valign="top" class="regTextBlack">
   <td>&nbsp;</td>
   <td><input name="sendEmail" type="submit" class="formInput" value="Send Email"></td>
  </tr>
 </table>
</form>      
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13866624
as your commRecipient variable contains a name for an email group, you need to map this name in emailGroup.asp to the real email address, that's all
0
 

Author Comment

by:dyarosh
ID: 13866819
First thank you for changing my email and link.  Have been so frustrated with this problem I didn't even think about it when I posted the code.

I'm not sure I understand your comment about the commRecipient variable.  Do I take the commRecepient value and use an onsubmit function to pull out the email addresses and then map them to the recepient variable?  It is my understanding that the recepient variable controls who the email is sent to.
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 750 total points
ID: 13867052
hmm, sounds like you're missing some knowledge about how browser and server communication and data exchange works with HTTP, dyarosh

The browser does nothing with your form, just sending the server an URL like:
  http://your.tld/../cgi_bin/FormMail.pl?recipient=user@domain.tld&commRecipient=all& -- some more parameters here --

if was "all" selected in the listbox and the user hits the submit button
(used an GET example for simplicity, instead of POST as your form does)

Now your FormMail.cgi receives these parameters and has to split them into name-value pairs (usualy done by CGI.pm in perl), there you get the value of commRecipient, something like:
  my $q=new CGI;
  my $r=$q->param('commRecipient');

now you have "all" stored in $r and you can proceed to search your database to retrieve the email address mapped to this value.
0
 

Author Comment

by:dyarosh
ID: 13982430
The information you provided shows me how much I don't know.  My problem still isn't solved because it turns out that my web server prevents emails to other addresses not in its domain.  But at least now I know where the problem exists.  Thanks for your help.
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 13984013
> ..  my web server prevents emails to other addresses
well that's a mail server configuration problem, not one of your CGI usually
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial will discuss the log-in process using WhizBase. In this article I assume you already know HTML. I will write the code using WhizBase Server Pages, so you need to know some basics in WBSP (you might look at some of my other articles abo…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question