Forum OpenACS Development: Set up acs-mail-lite

Collapse
Posted by Iuri Sampaio on
Hi there,

I'm trying to use acs-mail-lite to send email from a website.

There's no errors on OACS side however emails get bounced because the field "from" is null, thus the user can't be properly authenticated. Please, see log file bellow from Postfix mail client.

In this case, no values were set at acs-mail-lite admin parameter's section.On the other hand, if I try to set parameters, whether I fill one parameter or all parameters in, at acs-mail-lite admin's section, I get errors.

One's already expected regarding list's parity constraints: "Invalid option list". The other's a bit tricky. It's a "Invalid Hello message" from ISP provider. Although, emails have been sent properly from prompt command line using "mail".

Unfortunately, I can't permanently set sender's information on postfix, because the application may choose different users to send emails occasionally, depending on the package or even the functionality used in the scenario.

I believe the correct setup would be to have all parameters cleaned and let from_addr be chosen at third package level. Meaning that If a pkg is created (i.e. "mypkg"), which has a chunk of code (i.e. a TCL script), with a call to [acs_mail_lite::send], as well as with its argument "-from_addr" also assigned to mailto:user@mail.com.

mailto:user@mail.com should work until the very last function responsible to deliver to Postfix the mail sender's info.

I added logs within packages/acs-mail-lite/tcl/acs-mail-lite-procs.tcl, at ad_proc acs_mail_lite::send, until the last conditional statement of it. -from_addr was properly assigned to it.

Please see error logs bellow.

############ Error 1: Bounced messages on Postfix.

== /var/log/mail.log ==
Jun 29 14:03:07 newiuri postfix/smtpd[8252]: connect from localhost.localdomain[127.0.0.1]
Jun 29 14:03:07 newiuri postfix/smtpd[8252]: E8A6F3F665B3: client=localhost.localdomain[127.0.0.1]
Jun 29 14:03:07 newiuri postfix/cleanup[8254]: E8A6F3F665B3: message-id= 8211.1404061387.4@newiuri
Jun 29 14:03:08 newiuri postfix/qmgr[25069]: E8A6F3F665B3: from= mailto:bounce-0-D6C61A8F774F70906A6875F381F53F9711C07CD6-376@natopia.com , size=6791, nrcpt=1 (queue active)
Jun 29 14:03:08 newiuri postfix/smtpd[8252]: disconnect from localhost.localdomain[127.0.0.1]
Jun 29 14:03:08 newiuri postfix/smtp[8255]: CF1A93F665B2: to= mailto:iuri@planetnatopia.com , relay=mail.natopia.com[50.87.144.18]:587, delay=0.5, delays=0.05/0.01/0.38/0.06, dsn=5.0.0, status=bounced (host mail.natopia.com[50.87.144.18] said: 550-Verification failed for mailto:bounce-0-0235150682E7DEEE0359BD535BAD39FF372B01B7-376@natopia.com 550-No Such User Here 550 Sender verify failed (in reply to RCPT TO command))
Jun 29 14:03:08 newiuri postfix/cleanup[8254]: 5D5FE3F665B7: message-id= mailto:20140629170308.5D5FE3F665B7@natopia.com
Jun 29 14:03:08 newiuri postfix/qmgr[25069]: 5D5FE3F665B7: from= , size=7759, nrcpt=1 (queue active)
Jun 29 14:03:08 newiuri postfix/bounce[8259]: CF1A93F665B2: sender non-delivery notification: 5D5FE3F665B7
Jun 29 14:03:08 newiuri postfix/qmgr[25069]: CF1A93F665B2: removed
Jun 29 14:03:08 newiuri postfix/smtp[8256]: E8A6F3F665B3: to= mailto:experiences@natopia.com , relay=mail.natopia.com[50.87.144.18]:587, delay=0.45, delays=0.05/0.01/0.34/0.05, dsn=5.0.0, status=bounced (host mail.natopia.com[50.87.144.18] said: 550-Verification failed for mailto:bounce-0-D6C61A8F774F70906A6875F381F53F9711C07CD6-376@natopia.com 550-No Such User Here 550 Sender verify failed (in reply to RCPT TO command))
Jun 29 14:03:08 newiuri postfix/cleanup[8254]: 6B6CA3F665B5: message-id= mailto:20140629170308.6B6CA3F665B5@natopia.com
Jun 29 14:03:08 newiuri postfix/bounce[8259]: E8A6F3F665B3: sender non-delivery notification: 6B6CA3F665B5
Jun 29 14:03:08 newiuri postfix/qmgr[25069]: 6B6CA3F665B5: from= , size=9046, nrcpt=1 (queue active)
Jun 29 14:03:08 newiuri postfix/qmgr[25069]: E8A6F3F665B3: removed
Jun 29 14:03:08 newiuri postfix/smtp[8255]: 5D5FE3F665B7: to= mailto:bounce-0-0235150682E7DEEE0359BD535BAD39FF372B01B7-376@natopia.com , relay=mail.natopia.com[50.87.144.18]:587, delay=0.48, delays=0/0/0.34/0.13, dsn=2.0.0, status=sent (250 OK id=1X1IVQ-0005ja-O3)
Jun 29 14:03:08 newiuri postfix/qmgr[25069]: 5D5FE3F665B7: removed
Jun 29 14:03:09 newiuri postfix/smtp[8256]: 6B6CA3F665B5: to= mailto:bounce-0-D6C61A8F774F70906A6875F381F53F9711C07CD6-376@natopia.com , relay=mail.natopia.com[50.87.144.18]:587, delay=0.6, delays=0/0/0.39/0.21, dsn=2.0.0, status=sent (250 OK id=1X1IVQ-0005je-RQ)
Jun 29 14:03:09 newiuri postfix/qmgr[25069]: 6B6CA3F665B5: removed

##### 2. Error with -from_addr assigned

[29/Jun/2014:14:57:30][9041.7f04eb2c8700][-conn:natopia:0] Notice: Sendig customer's email...
[29/Jun/2014:14:57:30][9041.7f04eb2c8700][-conn:natopia:0] Error: lang::message::lookup: Key 'natopia-notifications.customer_email_subject' does not exist in en_US
[29/Jun/2014:14:57:30][9041.7f04eb2c8700][-conn:natopia:0] Notice: Running ad_proc acs_mail_lite::send mailto:notifications@natopia.com
[29/Jun/2014:14:57:30][9041.7f04eb2c8700][-conn:natopia:0] Notice: Running ad_proc acs_mail_lite::send_immediately mailto:notifications@natopia.com
[29/Jun/2014:14:57:30][9041.7f04eb2c8700][-conn:natopia:0] Notice: FFROM mailto:notifications@natopia.com

##### 3. Error.log - Invalid Option List

referred by "http://dev.natopia.com/Retreats/details/luxury-eco-lodge-in-the-amazon-wildlife";
Each option must have a value! Invalid option list: -originator mailto:bounce-0-B1CB573FED704B17E36F72E8A4920FEA2ABABA5E-376@dev.natopia.com -header {From mailto:natopia@natopia.com} -header {Reply-To mailto:natopia@natopia.com} -header {To mailto:iuri@planetnatopia.com} -servers localhost -ports 25 -username natopia -password
while executing
"error "Each option must have a value! Invalid option list: $args""
(procedure "smtp::sendmessage" line 37)
invoked from within
"smtp::sendmessage ::mime::3 -originator mailto:bounce-0-B1CB573FED704B17E36F72E8A4920FEA2ABABA5E-376@dev.natopia.com -header {From mailto:natopia@natopia.com} -head..."
("eval" body line 1)
invoked from within
"eval $cmd_string"
(procedure "acs_mail_lite::smtp" line 30)
invoked from within
"acs_mail_lite::smtp -multi_token $tokens -headers $headers_list -originator $originator"
(procedure "acs_mail_lite::send_immediately" line 155)
invoked from within
"acs_mail_lite::send_immediately -to_addr $to_addr -cc_addr $cc_addr -bcc_addr $bcc_addr -from_addr $from_addr -reply_to $reply_to -subject $subj..."
(procedure "acs_mail_lite::send" line 12)
invoked from within
"acs_mail_lite::send -send_immediately -to_addr $to -from_addr $from -subject "[lang::message::lookup $locale natopia-notifications.customer_email_..."
("uplevel" body line 225)
invoked from within
"uplevel {
ad_page_contract {
} {
{email ""}
{firstname ""}
{lastname ""}
{email ""}
{product ""}
{phone ""}
{provi..."
(procedure "code::tcl::/var/www/natopia/packages/natopia-core/www/check-..." line 2)
invoked from within
"code::tcl::$__adp_stub"
("uplevel" body line 12)
invoked from within
"uplevel {

if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init t..."
(procedure "adp_prepare" line 2)
invoked from within
"adp_prepare"
invoked from within
"template::adp_parse [file root [ad_conn file]] {}"
(procedure "adp_parse_ad_conn_file" line 6)
invoked from within
"$handler"
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
$handler
} ad_script_abort val {
# do nothing
}"
invoked from within
"rp_serve_concrete_file [ad_conn file]"
(procedure "rp_serve_abstract_file" line 60)
invoked from within
"rp_serve_abstract_file "$root/$extra_url""
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
rp_serve_abstract_file "$root/$extra_url"
set tcl_url2file([ad_conn url]) [ad_conn file]
set tcl_url2path..."

#### Error 2. Invalid Hello message

[29/Jun/2014:14:39:26][9041.7f04eb2c8700][-conn:natopia:0] Error: POST http://ecommerce.natopia.com/natopia/core/check-availability-confirmation?
referred by "http://dev.natopia.com/Retreats/details/luxury-eco-lodge-in-the-amazon-wildlife";
550: Access denied - Invalid HELO name (See RFC2821 4.1.1.1)
while executing
"smtp::sendmessage ::mime::3 -originator mailto:bounce-0-B9908C3F2B79CDAD762F977058EB734B1FEBEDB4-376@dev.natopia.com -header {From mailto:natopia@natopia.com} -head..."
("eval" body line 1)
invoked from within
"eval $cmd_string"
(procedure "acs_mail_lite::smtp" line 30)
invoked from within
"acs_mail_lite::smtp -multi_token $tokens -headers $headers_list -originator $originator"
(procedure "acs_mail_lite::send_immediately" line 155)
invoked from within
"acs_mail_lite::send_immediately -to_addr $to_addr -cc_addr $cc_addr -bcc_addr $bcc_addr -from_addr $from_addr -reply_to $reply_to -subject $subj..."
(procedure "acs_mail_lite::send" line 12)
invoked from within
"acs_mail_lite::send -send_immediately -to_addr $to -from_addr $from -subject "[lang::message::lookup $locale natopia-notifications.customer_email_..."
("uplevel" body line 225)
invoked from within
"uplevel {
ad_page_contract {
} {
{email ""}
{firstname ""}
{lastname ""}
{email ""}
{product ""}
{phone ""}
{provi..."
(procedure "code::tcl::/var/www/natopia/packages/natopia-core/www/check-..." line 2)
invoked from within
"code::tcl::$__adp_stub"
("uplevel" body line 12)
invoked from within
"uplevel {

if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init t..."
(procedure "adp_prepare" line 2)
invoked from within
"adp_prepare"
invoked from within
"template::adp_parse [file root [ad_conn file]] {}"
(procedure "adp_parse_ad_conn_file" line 6)
invoked from within
"$handler"
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
$handler
} ad_script_abort val {
# do nothing
}"
invoked from within
"rp_serve_concrete_file [ad_conn file]"
(procedure "rp_serve_abstract_file" line 60)
invoked from within
"rp_serve_abstract_file "$root/$extra_url""
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
rp_serve_abstract_file "$root/$extra_url"
set tcl_url2file([ad_conn url]) [ad_conn file]
set tcl_url2path..."

Collapse
2: Re: Set up acs-mail-lite (response to 1)
Posted by Jim Lynch on
Could it be you supplied "-password" but failed to supply an argument?
Collapse
3: Re: Set up acs-mail-lite (response to 2)
Posted by Iuri Sampaio on
In fact, I let all fields empty. password shouldn't be an issue in this case.

If I filled one (pwd) I must fill them all.
If I fill them all I get a "Invalid Hello" message.

ps. mail command sents emails properly.

Collapse
4: Re: Set up acs-mail-lite (response to 3)
Posted by Jim Lynch on
Could you show the exact text of the call? It might be nice to see all the var assignments where those vars are free in the call
Collapse
5: Re: Set up acs-mail-lite (response to 4)
Posted by Iuri Sampaio on
Jim,

I believe I found the problem. acs-mail-lite wasn't planned to work with smarthost. Malte has written it without think about that. My OACS box (ecommerce.natopia.com) has to send email in the name of natopia.com.

As Postfix works properly with "mail" command line thus I addressed the problem to a TCL misconfiguration. Then, I started to track down the entire workflow for having an email packaged and delivered to postfix.

Here it is:

acs_mail_lite::send > acs_mail_lite::send_immediately > -originator >> acs_mail_lite::bounce_address > acs_mail_lite::address_domain > acs_mail_lite::smtp

Within ad_proc [acs_mail_lite::address_domain] there's a chunk which's responsible to assign originator's swtich. See bellow.

set domain [parameter::get_from_package_key -package_key "acs-mail-lite" -parameter "BounceDomain"]

if { $domain eq "" } {
regsub {http://} [ns_config ns/server/[ns_info server]/module/nssock hostname] {} domain
}

return $domain

Moreover, whether "BounceDomain" acs-mail-lite parameter is null or isn't properly assigned. It assumes by default the current domain, which in this case is ecommerce.natopia.com and it's not the correct one.

I'm not sure if that's the case to ammend acs-mail-lite core. It seems the problem's solved and now I have to deal with Hostgator mailing provider.

p.s. Now that Brazil's lost its chance to be World Cup Champion 2014 (with a historical score!!) I had more time and motivation to dig into that issue.

-- to the Deutsches (Malte, Frank, Klaus...): I wish you guys to be the 1st. Germany has strongly and well trained for that. Best of luck!

Collapse
6: Re: Set up acs-mail-lite (response to 5)
Posted by Iuri Sampaio on
Perhaps, parameter SMTPHost would be the one which should be used to set domain's TCL variable.

But then, we must make sure we're not breaking anything else that uses ad_proc acs_mail_lite::address_domain.

I'd need to dig further to be more assertive.