Modify

Opened 8 years ago

Last modified 20 months ago

#472 closed defect (fixed)

smtp_always_cc entries are not copied on an email2trac submission

Reported by: anonymous Owned by: bas
Priority: normal Component: EmailtoTracScript
Severity: normal Keywords: email2trac smtp_always_cc
Cc: Trac Release: 0.9

Description

I've noticed that email addresses defined in trac.ini's "smtp_always_cc" are never copied submissions via email2trac.

Only if a user submits a ticket using the Trac web form will these recipients receive a cc.

Attachments (0)

Change History (15)

comment:1 Changed 8 years ago by bas

  • Status changed from new to assigned

Which version of trac are you using?

I am using 0.8/0.9 and have no problems with it.

comment:2 Changed 8 years ago by anonymous

Trac 0.9.5, python 2.3.5 and pysqlite 2.3.2.

comment:3 Changed 8 years ago by anonymous

Just tested it with trac 0.9.5 and i always get a notification when i ticket is submitted or changed
via the web and email.

comment:4 Changed 8 years ago by anonymous

I'd be interested to know the Python and PySqlite versions others are using with their installations.

Thanks for the information. This is puzzling. We have quite a complex installation environment on Solaris. So, I'll have a more of a look at what is going on and report back. Please don't close this off yet.

comment:5 Changed 8 years ago by anonymous

I've just read the response of 2006-07-10 20:50:45. In saying "I always get a notification when i ticket is submitted or changed via the web and email" is the email address in "smtp_always_cc" different to the values in "always_notify_reporter"/"always_notify_owner". Was the "smtp_always_cc" addresses different to the reporter/owner for the test?

These two options perform notification by email correctly when an email submission is made. If set and the addresses are the same as the address in "smtp_always_cc" it may be these are the addresses being notified via the "always_notify_reporter"/"always_notify_owner" trigger.

I need to confirm this.

comment:6 Changed 8 years ago by anonymous

This are my settings:
{{{[notification]
smtp_enabled = true
smtp_always_cc = hic@…
smtp_server = localhost
smtp_from = test@…
#always_notify_reporter = true
}}}

The smtp_always_cc adress is different then the reporter/owner of the ticket. In our situation it is always different.

comment:7 Changed 8 years ago by anonymous

Thanks for the clarification.

I have looked through our logs and noticed some strange events. Sorry, there are a few pieces of information that are generated in the transaction where we can see what is happening.

In particular at the bottom one can see that (although times from another example of the same problem) after email2trac has been run and failed, subsequent web updates fail the smtp to smtp_always_cc and possibly others as Trac tries to send to "firstname lastname@…", where it may be attempting to reconstruct an (invalid) address not in the list of reporter of CC recipients from the following:

smtp_server: mail.site.net.au
"firstname lastname" is a valid user full name, but NOT their Trac LDAP login.

It was also the full name of one of the remoteuser account.

Note the space, no "." in this case. In this test environment is it also the real "Trac Project" name.

Two smtp_always_cc addresses where used in this test, remote to the local domain. They received the CC before an attempt was made using email2trac. It as not worked correctly on this ticket since with either web form or email2trac. Web for produces error at the very bottom. email2trac generates 2 entries in trac.log (time 22:49:00) but no reported error or emails.

From remote email client:

localuser@smtp:/home/localuser>less /var/tmp/msg.txt
From remoteuser@fastmail.fm Tue Jul 11 22:48:53 2006
Received: from mail1.site.net.au (mail1.site.net.au [xxx.xxx.xxx.xxx])
        by mail.site.net.au (8.13.6/8.13.6) with SMTP id k6BCmq1K010048
        for <tracproj@mail.site.net.au>; Tue, 11 Jul 2006 22:48:52 +1000 (EST)
Received: from mail-ihug.icp-qv1-irony1.iinet.net.au
From remoteuser@fastmail.fm Tue Jul 11 22:48:53 2006
Received: from mail1.site.net.au (mail1.site.net.au [xxx.xxx.xxx.xxx])
        by mail.site.net.au (8.13.6/8.13.6) with SMTP id k6BCmq1K010048
        for <tracproj@mail.site.net.au>; Tue, 11 Jul 2006 22:48:52 +1000 (EST)
Received: from mail-ihug.icp-qv1-irony1.iinet.net.au
        (ihug-mail.icp-qv1-irony1.iinet.net.au [203.59.1.195])
        by mail1.site.net.au (8.13.6/8.13.6) with ESMTP id k6BCmTe7026691
        for <tracproj@mail.site.net.au>; Tue, 11 Jul 2006 22:48:45 +1000 (EST)
Received: from 202-161-24-146.dyn.iinet.net.au (HELO [202.161.24.146])
        ([202.161.24.146])
        by mail-ihug.icp-qv1-irony1.iinet.net.au with ESMTP;
        11 Jul 2006 20:48:28 +0800
X-BrightmailFiltered: true
X-Brightmail-Tracker: AAAAAA==
X-IronPort-AV: i="4.06,227,1149436800";
        d="scan'208"; a="559553890:sNHT60630140"
Message-ID: <44B48CB5.40204@fastmail.fm>
Date: Tue, 11 Jul 2006 22:46:29 -0700
From: Firstname Lastname <remoteuser@fastmail.fm>
User-Agent: Thunderbird 1.5.0.4 (Windows/20060516)
MIME-Version: 1.0
To: tracproj@mail.site.net.au
Subject: Re: [Trac Project] #46: Test Ticket
References: <082.46b809a683b6c0cf801a0aeb4ffb4155@mail.site.net.au>
        <091.0a675208bce3f60edf191f5f5bab67ce@mail.site.net.au>
In-Reply-To: <091.0a675208bce3f60edf191f5f5bab67ce@mail.site.net.au>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-PMX-Version: 4.7.1.128075, Antispam-Engine: 2.4.0.264935,
        Antispam-Data: 2006.7.11.51432 external
X-Virus-Scanned: by amavisd-milter (http://amavis.org/)

Test of the msg.txt

localuser wrote:
> #46: Test Ticket
> ------------------------+---------------------------------------------------
>  Reporter:  localuser     |        Owner:  localuser
>      Type:  defect      |       Status:  new
>  Priority:  normal      |    Milestone:  milestone3
> Component:  component1  |      Version:
>  Severity:  normal      |   Resolution:
>  Keywords:              |
> ------------------------+---------------------------------------------------
> Comment (by localuser):
>
>  I've received input that some may have 0.9.5 functioning with email2trac.
>  The failure here could lie in in the pysqlite version, however no feedback
>  on this received yet.
>
>
(END)

Observation in Trac Proj trac.log

22:49:00 Trac[__init__] DEBUG: Sending SMTP notification to mail.site.net.au on port 25
22:49:05 Trac[__init__] DEBUG: Sending SMTP notification to mail.site.net.au on port 25

"mail" Mail server send log message:

Jul 11 22:49:13 mail sshd[10061]: [ID 800047 auth.info] Connection from 150.YYY.ZZ.28 port 40                                                             182
Jul 11 22:49:15 mail sshd[10061]: [ID 800047 auth.info] Failed none for localuser from 150.YYY.ZZ.28 port 40182 ssh2
Jul 11 22:49:15 mail sshd[10061]: [ID 800047 auth.info] Accepted hostbased for localuser from 150.YYY.ZZ.28 port 40182 ssh2
Jul 11 22:49:15 mail sshd[10063]: [ID 800047 auth.info] wtmp_write: problem writing /var/adm/wtmp: No such file or directory

After this, message Reporter receives in mailbox (eg. /var/mail/localuser)

From tracproj@mail.site.net.au Tue Jul 11 22:49:05 2006
Received: from [150.YYY.ZZ.32] (mail [150.YYY.ZZ.32])
        by mail.site.net.au (8.13.6/8.13.6) with ESMTP id k6BCn0N5010055
        for <localuser@mail.site.net.au>; Tue, 11 Jul 2006 22:49:01 +1000 (EST)
Content-Type: multipart/mixed; boundary="===============0757957941=="
MIME-Version: 1.0
X-Mailer: Trac 0.9.5, by Edgewall Software
X-Trac-Version: 0.9.5
X-Trac-Project: Trac Project
X-URL: http://www.site.net.edu.au/project/url
Subject: =?utf-8?q?Re=3A_=5BTrac_Project=5D_=2346=3A_Test_Ticket?=
From: Proj Name <tracproj@mail.site.net.au>
Sender: tracproj@mail.site.net.au
Reply-To: tracproj@mail.site.net.au
To: localuser@mail.site.net.au
Date: Tue, 11 Jul 2006 12:49:00 -0000
X-Trac-Ticket-URL: http://www.site.net.edu.au/project/url/ticket/46
Message-ID: <093.cc0cd163399151d45d1d7fe903051f7a@mail.site.net.au>
References: <084.59ff5d3bc037cf7ea83c0a5570972d2e@mail.site.net.au>
X-Trac-Ticket-ID: 46
In-Reply-To: <084.59ff5d3bc037cf7ea83c0a5570972d2e@mail.site.net.au>
X-Virus-Scanned: by amavisd-milter (http://amavis.org/)
Content-Length: 1107
Status: O
X-Status:
X-Keywords:
X-UID: 16843

--===============0757957941==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64

IzQ2OiBUZXN0IFRpY2tldA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KIFJlcG9ydGVyOiAgYW50aG9u
eSAgfCAgICAgICAgT3duZXI6ICBhbnRob255ICAgDQogICAgIFR5cGU6ICBkZWZlY3QgICB8ICAg
ICAgIFN0YXR1czogIGFzc2lnbmVkICANCiBQcmlvcml0eTogIG5vcm1hbCAgIHwgICAgTWlsZXN0
b25lOiAgbWlsZXN0b25lMw0KQ29tcG9uZW50OiAgMi4zbSAgICAgfCAgICAgIFZlcnNpb246ICAg
ICAgICAgICAgDQogU2V2ZXJpdHk6ICBub3JtYWwgICB8ICAgUmVzb2x1dGlvbjogICAgICAgICAg
ICANCiBLZXl3b3JkczogICAgICAgICAgIHwgIA0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KQ29tbWVu
dCAoYnkgQW50aG9ueSBHcmVlbik6DQoNCiB7e3sNCiBUZXN0IG9mIHRoZSBtc2cudHh0DQoNCiBB
bnRob255IEdyZWVuIHdyb3RlOg0KDQoNCiB9fX0NCg0KLS0gDQpUaWNrZXQgVVJMOiA8aHR0cDov
L3d3dy5tc28uYW51LmVkdS5hdS9wcm9qZWN0cy9hbnRob255L2FudGhvbnkvdGlja2V0LzQ2Pg0K
QW50aG9ueSBHcmVlbiA8aHR0cDovL3d3dy5tc28uYW51LmVkdS5hdS9wcm9qZWN0cy9hbnRob255
L2FudGhvbnk+DQpTYW5kYm94

--===============0757957941==--

Subsequently Web form based message changes result in the following:

22:24:57 Trac[__init__] DEBUG: Sending SMTP notification to mail.site.net.au on port 25
22:24:59 Trac[__init__] DEBUG: Sending SMTP notification to mail.site.net.au on port 25
22:24:59 Trac[__init__] ERROR: Failure sending notification on change to ticket #46: {'firstname lastname@mail.site.net.au': (550, '5.1.1 <firstnamelastname@mail.site.net.au>... User unknown')}
Traceback (most recent call last):
  File "/opt/local/lib/python2.3/site-packages/trac/ticket/web_ui.py", line 352, in _do_save
    tn.notify(ticket, newticket=False, modtime=now)
  File "/opt/local/lib/python2.3/site-packages/trac/Notify.py", line 213, in notify
    NotifyEmail.notify(self, ticket.id, subject)
  File "/opt/local/lib/python2.3/site-packages/trac/Notify.py", line 110, in notify
    Notify.notify(self, resid)
  File "/opt/local/lib/python2.3/site-packages/trac/Notify.py", line 47, in notify
    self.send(to)
  File "/opt/local/lib/python2.3/site-packages/trac/Notify.py", line 335, in send
    NotifyEmail.send(self, rcpt, hdrs)
  File "/opt/local/lib/python2.3/site-packages/trac/Notify.py", line 146, in send
    self.server.sendmail(self.from_email, [rcpt], msg.as_string())
  File "/usr/local/lib/python2.3/smtplib.py", line 687, in sendmail
    raise SMTPRecipientsRefused(senderrs)
SMTPRecipientsRefused: {'firstname lastname@mail.site.net.au': (550, '5.1.1 <firstnamelastname@mail.site.net.au>... User unknown')}

comment:8 Changed 8 years ago by anonymous

Further analysis of the problem has revealed that:

Only the ticket that had the email2trac submission fail can no longer process smtp_always_cc for subsequent web submissions.

I created a "new" ticket, smtp_always_cc action successful, then used web form to update ticket previously updated using email2trac and the failure of smtp_always_cc was observered. This was followed with a web form update to the "new" ticket, the smtp_always_cc action was successfully executed.

Appears that what is going from email2trac and being inserted into the Trac sqlite3 DB is populating at least one email address with a FULLNAME@localdomain email address instead of the valid addresses and this is causing a persistent fault in the DB for any future updates to the ticket. Seems like email address that come into email2trac in the form FIRST LAST <username@…>. This would be consistent with what I have seen.

This looks like a starting point. I will look at the data being stored in the valid and apparently corrupt ticket.

comment:9 Changed 8 years ago by anonymous

Ok, I can see what is happening.

Dump of ticket 46 (apparently nolonger function due due to email2trac insertion to database of the FULLNAME (John Citizen) for a remote submission being inserted into the database by the email parser rather than the email address and when the system attempts to notify the user the local domain is appended to the full name without the space. In this case the email address wasn't on the local domain but say jcitizen@…. Instead "johncitizen@…" was parsed. It doesn't exist. I guess this means I should be checking what the functions inserting "author" are really doing.

46|1152614405|dave|comment46|1152614597|John Citizen|comment
I've received input that some may have 0.9.5 functioning with email2trac. The failure here could lie in in the pysqlite version, however no feedback on this received yet.
{{{

Yes that is a valid thing to wait for.

}}}
46|1152614924|dave|status|new|assigned

46|1152615026|dave|comment46|1152615234|dave|comment
Probably want more info on this.
smtp_from active again

46|1152615539|dave|component|component1|blockm

46|1152615539|dave|comment46|1152615850|dave|comment46|1152620574|dave|comment46|1152620697|dave|comment
20:57:29. AN Update
Tue Jul 11 21:03:51 EST 2006 Updated
Tue Jul 11 22:22:27 EST 2006 further update
Tue Jul 11 22:24:35 EST 2006

Post start change

46|1152622139|John Citizen|comment
{{{

Test of the msg.txt

}}}

46|1152703675|dave|comment
ticket 47 created and cc again functioned, does it now function for 46 too?

47|1152703911|dave|status|new|assigned
47|1152703911|dave|owner|somebody|dave

47|1152703911|dave|comment
Post failure of ticket 46 retest after creation of this ticket.

comment:10 Changed 8 years ago by anonymous

You did some investigations ;-). To make it short you say that the reporter's name is inserted instead of email address and this is causing the problem or is het something else?

comment:11 Changed 8 years ago by anonymous

This appears to be the case, note the ticket_change table insertion is into the "author" field.

comment:12 Changed 8 years ago by anonymous

I have identified the exact behaviour causing the above failure. I have repeated with the svn head version and result is the same.

  • Reporter is always notified with any update put in via web form or email2trac
  • Any email addresses in the Web form CC list receive updates via web form or email2trac
  • Any email addresses in smtp_always_cc will receive emails until the first time that an update is submitted via email2trac. When the first email2trac submission is received the FULL NAME of FULL NAME<full.name@…> is stored as the item "author" in ticket_change.
  • Followup web form or email2trac submissions will be sent to the Reporter and any member on the CC list, but not the smtp_always_cc email addresses.

Note: Instead of sending to the email addresses in smtp_always_cc additional email sending (to at least one additional address) is to FULLNAME(lower case)@<smtp_defaultdomain>, note space removed. I'm using smtp_defaultdomain becuase we are on a large LAN and have many users. The resulting email address is not valid.

For any future update using the web form or email2trac then the smtp_alway_cc CC's will result in an attempt to send to the email address FULLNAME(lower case)@<smtp_defaultdomain> that was observed when the first attempt to send via email2trac occurred. Hence, the fault always generates the same email address for each update of the ticket.

No other interactions appear to be occuring, ie. the second or subsequent FULL NAME of the user sending in an update via email2trac is not used when constructing the invalid email addresses.

All this information is captured in /var/log/syslog

This appears that it could be a fault in Trac itself, just the effects are seen in email2trac because of what is being attempted.

comment:13 Changed 8 years ago by anonymous

I've implemented a fix for the fault. I'll post a patch when I have cleaned it up so that configuration is easy to manage.

comment:14 Changed 8 years ago by bas

Can you send me the patch?

comment:17 Changed 2 years ago by anonymous

I have this problem too (smtp_always_cc entries are not copied on an email2trac submission).
How can I fix it please?
Thank you.

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.