Forum OpenACS Q&A: ns_sendmail looking for body

Collapse
Posted by Michael Pulling on
I am new not just at ACS, but also at any sort of programming, so
please forgive my newbie-ness.

I have had an ongoing problem with downloads from my site. The
process,(which I now realize actually uses the groups module of acs,
not the download) triggers an email that notifies our salesmen of the
download and passes to him some form data. The bit of code that
should be sending the email is this:

------

        # The next 15ish lines added by ccro 05/02/01 to send mail to
someone when a download happens.
        set info "The following is an email to notify you that a
file has been downloaded from matisse.com.

"

        set dbUser [ns_db gethandle subquery]
        set selection [ns_db 0or1row $dbUser "select email from users
where user
_id=$new_user_id"]
        set_variables_after_query
        append info "Email Address: $email

"
        ns_db releasehandle $dbUser

        # Send an email to let someone know a download happened.
        ns_log Notice "In proc download_serve: send mail for
download..."
        append info "Downloaded File: $pseudo_filename

"
        # append info "Phone Number: $QQform_phone1

"
        # append info "Company Name: $company_name

"
        append info "Reason: $QQdownload_reasons
"
        ns_sendmail mailto:mpulling@fresher.com "matisse.com Download
Mailer" $info

------------
It doens't work, though. Neither the email notification, nor is the
user given the file he/she needs, and I'm at a loss. Here is the log
information:

----------
[28/Aug/2001:12:00:35][13378.9][-conn0-] Notice: In proc
download_serve: send mail for download...
[28/Aug/2001:12:00:35][13378.9][-conn0-] Error: no value given for
parameter "body" to "ns_sendmail"
no value given for parameter "body" to "ns_sendmail"
    while executing
"ns_sendmail mailto:mpulling@fresher.com "matisse.com Download Mailer" $info"
    (procedure "download_serve" line 113)
    invoked from within
"download_serve cns5 {}"
<blockquote> Error: no value given for parameter "body" to "ns_sendmail"
</blockquote>

-----------------

Can anyone help me out?
Thanks!

Collapse
Posted by Vinod Kurup on
Hi Michael,

Tip #1: When posting code or logs to the bboards, put them inside <pre> </pre> tags. It makes it much easier to decipher.

You're missing a parameter to ns_sendmail. The docs (at aols erver.com) say:

ns_sendmail to from subject body 
?extraheaders? ?bcc?
The parameters with ?'s around it are optional. So, it looks like you're missing a 'from' address. Try:

ns_sendmail mpulling@fresher.com webmaster@matisse.com "matisse.com Download Mailer" $info

Collapse
Posted by Michael Pulling on
Thanks, Vinod, for advising on both issues. I knew that the code looked like a jumble, but I didn't stop to think about it. Next time I'll make sure that it's legible.

I did what you said to sendmail, and it worked like a charm. I really wish that I had asked for help a week ago!

thanks again!