CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
Simple Mail Script with variable?

 



femu
Novice

Mar 13, 2002, 9:53 AM

Post #1 of 9 (4053 views)
Simple Mail Script with variable? Can't Post

Hi,

I'm looking for a simple mail script, that accepts a variable (similar to the stuff used over here). So I like to send an email to myself with an ID number as variable, the form should look likes:

<FORM ACTION="http://mypage.com/cgi-bin/sendme.cgi?123" METHOD=POST>


... some fields, like name, email, or whatever and then just a simple SEND button. So the 123 should be the variable.

Does anyone have something like this?

Thanks very much,

Felix


yapp
User

Mar 14, 2002, 3:42 AM

Post #2 of 9 (4048 views)
Re: [femu] Simple Mail Script with variable? [In reply to] Can't Post

I can't help you with such script. My mailfrom handler doens't handle this.

However, if you want to include more variables in a html <FORM> code, use hidden fields.


Code
  

<FORM method="POST" action="/cgi-bin/script.cgi">

<INPUT type="hidden" name="id" value="123">

<INPUT type="text" name="his_name">

<INPUT type="text" name="his_email">

<INPUT type="submit" value="Submit E-mail">

</FORM>


Yet Another Perl Programmer

_________________________________
~~> [url=http://www.codingdomain.com]www.codingdomain.com <~~
More then 3500 X-Forum [url=http://www.codingdomain.com/cgi-perl/downloads/x-forum]Downloads! Cool


femu
Novice

Mar 14, 2002, 10:42 AM

Post #3 of 9 (4039 views)
Re: [yapp] Simple Mail Script with variable? [In reply to] Can't Post

Hi,

thanks for the idea, but this doesn't help in this case. It should more work like the badlink.cgi over here. So calling the script with a variable and then open the form. The variable should then be included in the message.

regards,

Felix


yapp
User

Mar 14, 2002, 10:58 AM

Post #4 of 9 (4038 views)
Re: [femu] Simple Mail Script with variable? [In reply to] Can't Post

Sorry, I don't get it.Frown

badlink.cgi??
...with a variable and then open the form...?

[perl]
#!/usr/bin/perl -w

use strict;
use CGI();

my $cgi = new CGI();

print $cgi->header();

print <<END_PAGE;
<HTML><HEAD>
<TITLE> Variable in a page </TITLE>
</HEAD>
<BODY>
<H1> The variable </H1>
END_PAGE

print $cgi->param('the_variable_name');
print "\n";

print <<END_PAGE;
</BODY>
</HTML>
END_PAGE
[/perl]

Yet Another Perl Programmer

_________________________________
~~> [url=http://www.codingdomain.com]www.codingdomain.com <~~
More then 3500 X-Forum [url=http://www.codingdomain.com/cgi-perl/downloads/x-forum]Downloads! Cool


femu
Novice

Mar 14, 2002, 11:20 AM

Post #5 of 9 (4034 views)
Re: [yapp] Simple Mail Script with variable? [In reply to] Can't Post

Hi,

now I'm a little confused. I'm not a programmer :-) I just use scripts. Let me try to explain it again:

1, The user normaly clicks a link like ".../mail.html" (in this case a mail form) and then fills some fields and send it to a "mail.cgi"

2, I like to have the fast possibility to call the script directly, send a predefined information to my account and send the user back to a Thanks page. There should be only one thing flexible and should ie. go in the Subject line and that's the variable after the "mail.cgi". So if the user clicks the link (../mail.cgi?ID=123), I like to recieve a short message with the 123 in the subject or body (I don't care) and the user sould then be send to the thanks.html

Background: I like to use the same script for different "subjects". The hidden field doesn't help, since then I would have to create various html forms ...

I hope I made clearer now.

Thanks very much for your help on this.

Felix


James
Troll

Mar 14, 2002, 4:29 PM

Post #6 of 9 (4031 views)
Re: [femu] Simple Mail Script with variable? [In reply to] Can't Post

I think this is more of a forms question than a programming question. You just want to be able to pass a variable in the URL. For example, you could do a WHOIS lookup on perlguru by going to http://www.nicforce.net/whois/ and entering the domain name in the text box, or you could bypass the text entry box by passing the variable in the URL, like this: http://www.nicforce.net/whois/index.cgi?domain=perlguru.com.

All I did in the 2nd example was add the variable name and the variable value after the ?. So, in your example, you forgot the variable name:

http://mypage.com/cgi-bin/sendme.cgi?123

should be

http://mypage.com/cgi-bin/sendme.cgi?varname=123

where varname = the name of the variable whose value you're trying to pass.

But doing that inside of a FORM ACTION tag has basically the same effect as using a hidden variable -- you're just unhiding it and making it static. So I don't think adding the variable to the URL in the FORM ACTION tag is the solution you're looking for.

I think what you're after is a unique ID for each message? That would have to be accomplished by the program, not by the FORM tag. There would be no point in modifying the URL in the FORM ACTION tag -- you just need the program to create the unique ID and pass it along when the form is submitted.

I don't know of any prewritten mail form scripts that do that.

James


femu
Novice

Mar 14, 2002, 7:33 PM

Post #7 of 9 (4027 views)
Re: [James] Simple Mail Script with variable? [In reply to] Can't Post

Hi James,

you're right. It should have been ...?varname=123

In fact I do not really need a form action, if the desired cgi programm handle can that. I looked around a found alot of emailing tools. But they all need a form to get the input. What I like to have is a much more "easier" solution. That's what you described at the beginning. Just send me a mail with the predefined variable. So I get ie. whet clicking below a simple mail (maybe with some additional text) and the ID in the subject line, like "Information for ID=123. Or whatever set after the ?ID=.

http://wwwmydomain.com/cgi-bin/sendmail.cgi?ID=123

and finally the tool should then send the user to a thanks.html page. So if everything will be handled by the program, I'm happy!

So a message the may look like:

To: me

From: MyTool

Subject: Information for ID=123

Body: some bla, bla



If I could define different varnames, which causes the program to send different mails, I would get the perfect tool, since then I can handle different situations (means if varname=id, send mail1, if varname=new, send mail2, and so on). Maybe out of a textfile.

Thanks,

Felix


yapp
User

Mar 15, 2002, 3:14 AM

Post #8 of 9 (4025 views)
Re: [femu] Simple Mail Script with variable? [In reply to] Can't Post


In Reply To
now I'm a little confused. I'm not a programmer :-) I just use scripts

Sorry for that. Sometimes programmers post some code here. I don't have the time to do the job for you. Tongue

Yet Another Perl Programmer

_________________________________
~~> [url=http://www.codingdomain.com]www.codingdomain.com <~~
More then 3500 X-Forum [url=http://www.codingdomain.com/cgi-perl/downloads/x-forum]Downloads! Cool


femu
Novice

Mar 15, 2002, 6:42 AM

Post #9 of 9 (4022 views)
Re: [yapp] Simple Mail Script with variable? [In reply to] Can't Post

No problem. Maybe one of those guys, which has already written one of those emailing programs can modify his/her one a little bit Cool

Thanks,

Felix

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives