Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Email after modify a record

Quote Reply
Email after modify a record
Hello and thanks to TheStone

Email after add record works

sub {
my $tags = shift;
my $home = $tags->{home};
my $hsh = $home->{hsh} || $tags->{values};
use GT::Mail;
my $msg = "Hallo $hsh->{user_id}";
GT::Mail->send (
sendmail => $home->{glb_cfg}->{db_mail_path},
to => $home->{user}->{Email},
from => 'email@domain.de',
subject => 'Subject',
'Content-type' => 'text/html',
msg => $msg
) or die "Error: $GT::Mail::error";
}

but it dosent work by modify a record.

Who can help

Thanks hoefti
linktobuy Web Directory
Ratgeber Recht
Quote Reply
Re: [hoefti] Email after modify a record In reply to
Hi,

You may want to set a same tag for this global on modify_success.html template. Feel free to let me know if you found any problems with this.

Cheers,

Jean
Gossamer Threads Inc.
Quote Reply
Re: [jean] Email after modify a record In reply to
hello jean


the function worls in add_success.html

but it dosent works in modify_success.html

The values are the same

Why ?

Can you help me?
linktobuy Web Directory
Ratgeber Recht
Quote Reply
Re: [hoefti] Email after modify a record In reply to
oh sorry for my new Post. i seen this to late
linktobuy Web Directory
Ratgeber Recht
Quote Reply
variables in Email after modify a record In reply to
That code works nicely, thanks.

Users in my db can add / modify records in several tables. I'd like the email to contain the table name they have added to. How would I modify the above code to do that please?

Once I have the table name I presume I can use $hsh->{column_name} to put a bit more useful information into the email.

I'd also like to be able to send the user a confirmation email. Is there an easy way of getting the email address out of the users table?
Tim Ault
Oxford UK
Quote Reply
Re: [timbo] variables in Email after modify a record In reply to
Ok, I've realised that this expression gets the user's email address :

$home->{user}->{Email}

Would still appreciate a reply to my question about the current db, if anyone knows ...

Also one further question. I'm calling the global code with the following tag in add_success.html <%send_email_user_add%>
I get a nasty message returned which looks like this:
GT::Mail=HASH(0x8492548)

Can I suppress this?

Last edited by:

timbo: Sep 20, 2003, 1:49 AM
Quote Reply
Re: [timbo] variables in Email after modify a record In reply to
In Reply To:
Also one further question. I'm calling the global code with the following tag in add_success.html <%send_email_user_add%>
I get a nasty message returned which looks like this:
GT::Mail=HASH(0x8492548)

Can I suppress this?
Make your global return something explicitly, such as a null string. It's returning a hash ref, perhaps as the result of something else it called.
Quote Reply
Re: [jxh] variables in Email after modify a record In reply to
I've adapted this global to send an email when a record is added. Working fine.

Users can add records to several tables.

I'm still trying to work out how to include the table name in the email. Can anyone help? I've tried <%db%>, but that doesn't work - I guess this format is only for the form templates ....

many thanks
Tim Ault
Oxford UK
Quote Reply
Re: [timbo] variables in Email after modify a record In reply to
Silence ... Does this mean this can't be done???
Quote Reply
Re: [timbo] variables in Email after modify a record In reply to
I've adapted Stone's code above. I'd like to make the message a bit longer and put in some hard returns so I tried this :

my $msg = "$home->{user}->{Name}, Welcome to the Directory\n\n We hope you will enjoy using this site. \n\n etc etc\n\n";

The hard returns don't work and when I receive the email the text is all one line. Any ideas what I need to do please?

Also can I do something like this

my $msg = "$home->{user}->{Name}, Welcome to the Directory\n\n";
$msg .= We hope you will enjoy using this site. \n\n ";

This doesn't seem to work either. Must get a decent book on perl ...

thanks
Tim Ault
Oxford UK
Quote Reply
Re: [timbo] variables in Email after modify a record In reply to
Try to change the 'Content-type' to ''text/plain" instead of 'text/html'. You can also use '<BR>' for new line if you want to send 'text/html' format.

TheStone.

B.
Quote Reply
Re: [TheStone] variables in Email after modify a record In reply to
Thanks
Quote Reply
Re: [hoefti] Email after modify a record In reply to
I'm new to DBmanSQL

Can you tell me where you place the sub for the Email after add

Thanx,

Bill