On Mar 20, 12:24 pm, annet <annet.verm...@gmail.com> wrote: > In my application I have a table npa which contains non-physical > addresses, i.e. telephone numbers, fax numbers, e-mail addresses etc. > that are displayed on business cards. This table has a field company > which references a table company. Initially I inserted addresses into > these tables which I got from the Chamber of Commerce. Now I would > like to send a first e-mail to these companies, based on the e-mail > addresses in the npa table. In this first mail the recipient gets the > opportunity to register himself as contact person for a company. The > table contact_person contains a field e-mail_address, which I would > like to use for future promotional e-mails, instead of the e-mail > address in the npa table. However, if the recipient doesn't register > as a contact person, I have to be able to use the e-mail address from > the npa table. > > Furthermore, I need a table which keeps track of the unsubscribe > request.
Do you? Well - you may want to keep track of events (timestameps, perhaps IP addresses) - and you could have significant events as: - created; - last used; - unsubscribed; - (perhaps a link to which company this was a contact for); The way you describe this problem sounds like a very familiar pattern: contact / alternate; In your case, you have it a little different: alternate is primary, i.e. default / contact; If your npa table contains fields to reflect this (default-email / registered-email --- something like that); then it would be a trivial excercise to email to registered-email if not None (for example, if these fields were references), else to default. Your contact table could have the "created / last used / unsubscribed" dates, and (possibly - though you don't need it) link to company. IF you have the possibility for one contact or email to be primary for more than one, then you would may want a one-to-many (user-to-npa) table to hold the "events", that is: user, npa, event type (subscribe / unsubscribe / mail sent / etc.), and event timestamp... anything else you would think useful. That way, if you have a person who might be both a contact for their company, and (say) also for some agency (say, a local sports center or team), you would be able to handle it. Hope this helps a little. - Yarko > > Did one of you face a similar problem? How did you solve it? > > Kind regards, > > Annet. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.