Forum OpenACS Development: Response to new spam package

Collapse
Posted by Yonatan Feldman on
it has a pretty simple tcl api that currently looks like this:

    ad_proc -public new {
        {-package_id ""}
        {-send_date ""}
        {-date_format "YYYY MM DD HH24 MI SS"}
        {-from_addr:required} 
        {-subject ""}
        {-reply_to ""}
        {-extra_headers ""}
        {-message:required}
        {-query:required}
    } { 
        create a new bulk_mail message
        
        @param package_id which instance does this bulk_mail belong to
        @param send_date expects a date in the date_format format. if no date
                         is passed it will use the current date and time
        @param date_format how to parse send_date, defaults to
                           "YYYY MM DD HH24 MI SS"
        @param from_addr from email address to bulk_mail from, can be
                                       overridden by a value from the query
        @param subject subject of the bulk_mail message, can be overridden
                              by a value from the query. will be interpolated
                              with values from the query.
        @param reply_to reply_to email address for the bulk_mail, defaults to
                               the value of the from_addr parameter, can be
                               overridden by a value from the query.
        @param extra_headers a list of key, value pairs of extra headers to
                             stick in the email, such as 'X-Mailer' or
                             'Content-type'
        @param message the body of the email, can be overridden by a value
                       selected in the query. will be interpolated with values
                       from the query.
        @param query a query that must select the email address to send to as
                     'email' and can select any other values that will be
                     interpolated into the subject and message of the bulk_mail for
                     each recipient. if column 'foo' is selected it's value
                     will be interpolated anywhere that '{foo}' appears in the
                     subject or message of the bulk_mail. if columns 'from_addr',
                     'reply_to', 'subject', or 'message' are selected, their
                     respective values will also become the 'from_addr',
                     'reply_to', 'subject', and 'message' on a per recipient
                     basis.

        @return bulk_mail_id the id of the newly created bulk_mail message
    }

the pl/sql and pl/pgsql apis are a little bit less functional, basically, they don't default the reply_to address to the from address, don't default the package_id to the current package ([ad_conn package_id]), nor do they check for the presence of the 'email' column in the supplied query.

i haven't been able to come up with a use case for acs-service-contract or regular callbacks, but if necessary we can always add this later. as soon as i write the tcl pages (and somehow test the postgresql port) i will commit it to the openacs tree so anyone can check it out.