Gossamer Forum
Home : Products : DBMan : Customization :

?: Email address based on select field chosen

Quote Reply
?: Email address based on select field chosen
Hi,

I'm trying to use the "Send Email Notice Depending On A Select Field Chosen" code, as found in
the Unofficial FAQ (http://webmagic.hypermart.net/dbman/email26.txt).

Per the FAQ, I've set up a series of variables in my .cfg file, like so:

$maint_email{'Shop A'} = 'joe@ShopA.com';
$maint_email{'Shop B'} = 'fred@ShopB.com';

and so on.

Then, in sub html_add_success, I have changed the email
notification code from:

print MAIL "To: $maint_email\n";

to:

print MAIL "To: $maint_email{$rec{'MaintenanceContacts'}}\n";

However, the email address identified in the .cfg file for the MaintenanceContacts
is not being pulled into the address, and the mail is not sent.

If anyone can illuminate my problem here, I'd appreciate it very much!

thanks,
-rckeller





"I can think of no more stirring symbol of Man's humanity to man than a Fire Engine."
Quote Reply
Re: ?: Email address based on select field chosen In reply to
I'd check this:

$maint_email{$rec{'MaintenanceContacts'}}

It doesn't seem right.

You either want $maint_email{MaintenanceContacts} or $rec{MaintenanceContacts}

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: ?: Email address based on select field chosen In reply to
Paul, thanks for taking the time to reply to my post.

Unfortunately, these did not seem to work. I'm afraid I'm still scratching my head...

thanks,
-rckeller

"I can think of no more stirring symbol of Man's humanity to man than a Fire Engine."
Quote Reply
GOT IT: Email address based on select field chosen In reply to
I found the problem!

This line needs to be inserted in the sub html_add_success, before the "print MAIL" sequence:

%rec = &get_record($in{$db_key});

This pulls the record-specific information required (that is, {$rec{$'MaintenanceContacts'}} ), and
inserts it into the email address specified by $maint_email{$rec{'$MaintenanceContacts'}}.



"I can think of no more stirring symbol of Man's humanity to Man than a Fire Engine."
Quote Reply
Re: GOT IT: Email address based on select field chosen In reply to
I will add your solution to the FAQ reference file.

Thanks for posting the fix for this!



Unoffical DBMan FAQ
http://webmagic.hypermart.net/dbman/
Quote Reply
Re: GOT IT: Email address based on select field chosen In reply to
You have an extra $ that isn't needed after $rec{'

Mods:http://wiredon.net/gt/download.shtml
Installations:http://wiredon.net/gt/
Quote Reply
Re: GOT IT: Email address based on select field chosen In reply to
Ah, you're right, the second { is not needed. This was a typo in my post; sorry, it was late/early!

-rich

"I can think of no more stirring symbol of Man's humanity to Man than a Fire Engine."