Gossamer Forum
Home : Products : DBMan : Customization :

E-mailing records

(Page 1 of 2)
> >
Quote Reply
E-mailing records
When a user gets a (single) record on-screen I would like to provide a link to mail that record to him/her or someone else. I'm sure this has been covered before but can't find the solution. Anyone who can point me in the right direction?

C.
Quote Reply
Re: E-mailing records In reply to
Yes, it has been covered a few times. You might look at the thread about "rec info to the textarea" for a start.

If that's not enough, I need to tell me in excruciatingly minute detail about what you want to do. Do you want a link to have the email sent? Where will the email address for the recipient be entered? Do you want them to be able to edit the message before it goes out?


------------------
JPD





Quote Reply
Re: E-mailing records In reply to
I've read through the thread you indicated. It's not exactly what I want but it could well do.

What I had in mind was:

The users finds a recipe on my site, clicks on the link and the recipe opens full screen or in a frame. At the bottom of the recipe it says:

"Mail this recipe!" (or something like it).

Clicking on that link mails the recipe to _a user entered address_ (not a fixed one).
In fact the above thread deals with a fixed mail address, does it not? Otherwise perhaps that solution is better, because the user can add comments to the file sent.

C.
Quote Reply
Re: E-mailing records In reply to
So you want a form to come up with the recipe in it, along with text fields to enter the recipient's address and comments. Right?


------------------
JPD





Quote Reply
Re: E-mailing records In reply to
Right.

I've been trying to modify the solution to thread you suggested and fixing a few typos I managed to get it to display the mailing link. But I got "Unkown Action" when clicking on the mail link. I'll look into that and see if it's yet another trivial typo.

And naturally there was a blunder on my part, which I fixed. So now I get the form but the record content is not transfered to the new form, and I don't know if the submit button works. (I've not gotten anything yet). And the "mail sent" form doesn't display.

More comparisons to do then.
Cheers,

C.
(PS. An extremely rough draft of the form is available through http://www.bahnhof.se/~chimbis/tocb/recipes/index-new.html - click on a new recipe and "Mail ...").
[This message has been edited by Chimbis (edited August 22, 1999).]

[This message has been edited by Chimbis (edited August 22, 1999).]
Quote Reply
Re: E-mailing records In reply to
I promise I'll get back to you, but I'm just not up to writing a lot of code today.


------------------
JPD





Quote Reply
Re: E-mailing records In reply to
I got the code for you at

http://www.jpdeni.com/...Mods/send_record.txt

It's pretty much the same as the Private Mailer, with a few changes.


------------------
JPD





Quote Reply
Re: E-mailing records In reply to
Thanks a lot!
I got "Action unknown" when clicking on submit on the e-mail form though.
What is the "|" in |/usr/lib/sendmail -t -oeq?

C.
Quote Reply
Re: E-mailing records In reply to
I don't know if I can explain the reason the | character is needed in |/usr/lib/sendmail -t -oeq. All I know is that it is needed.

As for the "unknown action," that was my fault. I didn't change one of the lines from the other mod I was using for a basis of the script. Sorry 'bout that.

In sub html_forward_email_form, change

Code:
<INPUT TYPE="SUBMIT" NAME="send_email" VALUE="Send Email">

to

Code:
<INPUT TYPE="SUBMIT" NAME="forward_email" VALUE="Send Record">


------------------
JPD





Quote Reply
Re: E-mailing records In reply to
Thanks. Nice, and it sends emails too. :-)
There isn't a recipe in the mail though, but I suppose I just modify the send mail form to read

...
<textarea name="emailmessage" cols=40 rows=10 wrap="virtual">
$rec{'Recipe'}
</textarea>
...

etc. Adding a call for each field I want included?


2/ Just on a whim I hit submit on an empty form:

fatal error: Undefined subroutine &main::html_send_email_form called at db.cgi line 1141.

Script Location : db.cgi
Perl Version : 5.00404
Setup File : recipe.cfg
User ID : default
Session ID : default

I'm not at a telnet'able connection right now so I can't give you more info. Sorry.
C.

[This message has been edited by Chimbis (edited August 23, 1999).]
Quote Reply
Re: E-mailing records In reply to
Thanks it now works.
I added two new variable to the script db.cgi.

One that inserts a entry string saying what the mail is about. A second on inserting a disclaimer and complaint address. These are added in db.cgi so that the user can not remove them from the textarea before sending it off.

BTW would it be difficult to specify sending the contents of several records in one email message? I am NOT asking you to do this ... Just a thought on my part.

Cheers and thanks for all help.

C.
Quote Reply
Re: E-mailing records In reply to
Excellent!

You could possibly set up a routine to send out email to several people at once.

You could copy the email_to field for as many addresses as you wanted to send it to.

Then, in the subroutine that sends the email (can't remember what it's called right now Smile ), split the $in{'to_email'} fields into an array. Something like

Code:
@email_addresses = split "~~", $in{'to_email};

Then stick the whole email routine into a loop:

Code:
foreach $address (@email_addresses) {
the mailer routine, using
print MAIL "To: $address\n";

}

You would also probably want to add my modification of sub parse_form that's at

http://www.jpdeni.com/dbman/Mods/changes.txt

Otherwise you'll get some empty addresses.

------------------
JPD





Quote Reply
Re: E-mailing records In reply to
Yes. Of course - I should have spotted that myself. I was at work, so shouldn't have been playing with it at all really.

I'll change that and test it again.

Thanks.

C.
Quote Reply
Re: E-mailing records In reply to
 
Quote:
<textarea name="emailmessage" cols=40 rows=10 wrap="virtual">
$rec{'Recipe'}
</textarea>
...
etc. Adding a call for each field I want included?

Yep.

RE #2 -- Another error on my part. (that's why I give you folks these mods -- so you can find my errors! Wink)

In db.cgi, sub forward_email, change

&html_send_email_form($message);

to

&html_forward_email_form($message);

Again, sorry 'bout that.

------------------
JPD





Quote Reply
Re: E-mailing records In reply to
Once again, things just don't work for me...

I have this mod in place, and it works just fine, except that I can not get anything to be sent in the email except what the person types in. I am using the long/short mod and I think that this may be messing things up. For some reason the $rec{'Title'} field get's erased in this mod.

I am also having a similar problem with a "Request Info Mod" that I have been working on. **Wouldn't it be nice to get both of these fixed with one sweeping answer**

Is there any help for me or should I burn my pc, sell my home and move to Tibet!?!
Quote Reply
Re: E-mailing records In reply to
dataKing,

Since you are on a NT server, try using SMTP Socket Mail codes rather than sendmail.

Search this forum for SMTP.

Regards,

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: E-mailing records In reply to
Thanks for the tip Eliot, but I don't think that it will help me because I am already using SMTP to send the mail instead of Sendmail.

I am not having a problem with the mail being sent. In fact, the email shows up in my mail box just fine. The problem that I am having is that the contents of the page are NOT being transfered to the email message, and therefore they are not being emailed with the message.

My problem is that my fields get erased before they appear in the text box.

Quote Reply
Re: E-mailing records In reply to
I know I made things harder on myself for using the templated v. of DBman but...

Has anyone got this mod to work with the templates? I can't get it to work for the life of me. It keeps saying that my email address is in an invalid format (and its not) and it will not put the actual review into the textarea. It seems as though it is not even referencing the record to be sent. Maybe I just don't have the variable's set right for the subroutine or something... I dunno.

I am currently redesigning the site and this is pretty much the last thing that I'd like to do before I start my other databases (based off this one). If someone could take a look at my site or the script, that would be totally awesome!

You can see my beta dbm at:
extreme.nas.net/cgi-bin/db-templates/db.cgi and login as guest/guest

I can make the .cfg, db.cgi etc. files available upon request.

Thanks!!

------------------
Jason
Extreme mtb
extreme.nas.net

[This message has been edited by jdulberg (edited December 01, 1999).]
Quote Reply
Re: E-mailing records In reply to
Cool, I got it working - sort of. I had to make up a bunch of variables so I can pass the links and stuff through the templates... I'm still getting the "incorrect format" message but as you said, I could just # that section out. It would be nice to get that working though. Also, I was wondering if it is possible to do line breaks? So each field would be on its own line -- is this biting off more than I can chew?

Thanks for your help!!!!!

------------------
Jason
Extreme mtb
http://extreme.nas.net
Quote Reply
Re: E-mailing records In reply to
Two things,
I had the same problem with the email format, as did several other people in this forum. For now, I have solved it by using the mighty " # " by removing the command lines that do that. Now, by doing that you remove the checking routine, but at least the email get's sent.

As for you other problem, I am pleased to say that I just got it figured out!

1. In html.pl in the "sub html_record_long" add this line after: my (%rec) = @_;

Code:
$rec{$db_key} =~ s/<.?B>//g;


2. In html.pl in the "sub html_record_long" use this line as your URL link:

Code:
<a href="$db_script_link_url&more_info_form=1&$db_key=$rec{$db_key}">Request More Info</a>

3. In html.pl in the "html_more_info_form" change
Code:
<textarea name="email_message" rows=5 cols=40 wrap="literal">
$rec{'Title'} :: $rec{'ID'}
</textarea>

TO

Code:
<textarea name="emailmessage" rows=5 cols=40 wrap="literal">
$rec{'Title'} :: $rec{'ID'}
</textarea>

That should do it! I hope it works for you and if not, feel free to give me a hollar.

[This message has been edited by dataKing (edited December 02, 1999).]
Quote Reply
Re: E-mailing records In reply to
Glad that I could help. I have mooched so much stuff of people in this forum, that I am doing my best to give back!

When you say line breaks, are you talking about putting <br> in the email itself? There is a way to mod the email so that it is sent in rich html format. You will have to dig in the forum for that one though. I saw it there today while trying to figure something else out.

Let me know what you find, and if you ever figuer problem #1 out.

Quote Reply
Re: E-mailing records In reply to
Hey,
I found a bug in JPDenis's script that will solve the "Email Address in wrong format" bug that we both had.

Try changing

Code:
sub more_info {
unless ($in{'email'}) {
$message = "You must enter your email address";
}
unless ($in{'$email'} =~ /.+\@.+\.+/){
$message = "<font Color=”red”><b> Your email address is not in the correct format. Please try again.</b></font>."
# }
if ($message) {
&html_more_info_form;
return;
}

TO

Code:
sub more_info {
unless ($in{'email'}) {
$message = "You must enter your email address";
}
unless ($in{'email'} =~ /.+\@.+\..+/)
{
$message = "<font Color=”red”><b> Your email address is not in the correct format. Please try again.</b></font>."
}
if ($message) {
&html_more_info_form;
return;
}


It is a really small change but it makes a big difference.

Smile Phew! That took a whole lot of work to find!
Quote Reply
Re: E-mailing records In reply to
I guess that the version that I downloaded already had that change in it 'cuz I'm still encountering the problem. You change was the "." in the email thing and the "#" right?

Here's what I have in my sub

Code:
unless ($in{'email'}){
$message = "You must fill in your email address<BR>"; }

unless ($in{'email'} =~ /.+\@.+\..+/) { $message = "Your email address is not in the correct format.<BR>"; }

unless ($in{'to_email'}) { $message = "You must fill in the recipient's email address<BR>"; }

unless ($in{'to_email'} =~ /.+\@.+\..+/) { $message = "The recipient's email address is not in the correct format.<BR>"; }

unless ($in{'subject'}) { $message .= "You must fill in a subject for your message.<BR>"; }

unless ($in{'emailmessage'}) { $message .= "Your email message is empty.<BR>"; }

I've been staring at it for a while now, and I can't figure it out either. Most likely, its something trivial but those are always the most annoying little errors!

------------------
Jason
Extreme mtb
http://extreme.nas.net
Quote Reply
Re: E-mailing records In reply to
I am sorry to hear that you are also having problems! I am going nuts trying to get this thing to work!

I have moved onto a different version, in hopes that it will be easier, and in fact, I am not having the email in wrong format error. But I am now having problems passing the info from the record to the textarea.

I posted new thread in the forum for that one.

To answer your question, I think the error was occuring partly because of $in{'email'}
looking like $in{'$email'}.

At least when I make that change that part of the mod works...

Can you post your html.txt and db.txt on the web so that I can check your work?
Quote Reply
Re: E-mailing records In reply to
Thanks, I will check into your files to see what you did. But as for now, I found an error on the login of your script.

If you turn debugging on in ie 5.0, you will see it come up.

Line: 134
Error: Object expected
Code: 0
script Location: bd.cgi


Otherwise, nice site!
> >