mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-30 20:55:17 +01:00
Enable the message_gateway to handle sending all email to a specific user. The current
scanning on to: and from: fields does not work if you bcc Tracks in email. site.yml.tmpl is updated to reflect this and removes cas, ldap and openid configs Also the integrations page is updated to reflect the above
This commit is contained in:
parent
0b1d521bbf
commit
05695c12ea
5 changed files with 44 additions and 31 deletions
|
|
@ -23,11 +23,9 @@ class MessageGateway < ActionMailer::Base
|
|||
end
|
||||
end
|
||||
|
||||
# stupid T-Mobile often sends the same message multiple times
|
||||
return if user.todos.where(:description => description).first
|
||||
|
||||
todo = Todo.from_rich_message(user, context.id, description, notes)
|
||||
todo.save!
|
||||
Rails.logger.info "Saved email as todo for user #{user.login} in context #{context.name}"
|
||||
end
|
||||
|
||||
private
|
||||
|
|
@ -37,10 +35,18 @@ class MessageGateway < ActionMailer::Base
|
|||
end
|
||||
|
||||
def get_user_from_email_address(email)
|
||||
address = get_address(email)
|
||||
user = User.where("preferences.sms_email" => address.strip).includes(:preference).first
|
||||
if user.nil?
|
||||
user = User.where("preferences.sms_email" => address.strip[1.100]).includes(:preference).first
|
||||
if SITE_CONFIG['email_dispatch'] == 'single_user'
|
||||
Rails.logger.info "All received email goes to #{ENV['TRACKS_MAIL_RECEIVER']}"
|
||||
user = User.find_by_login(ENV['TRACKS_MAIL_RECEIVER'])
|
||||
Rails.logger.info "WARNING: Unknown user set for TRACKS_MAIL_RECEIVER (#{ENV['TRACKS_MAIL_RECEIVER']})" if user.nil?
|
||||
else
|
||||
address = get_address(email)
|
||||
Rails.logger.info "Looking for user with email #{address}"
|
||||
user = User.where("preferences.sms_email" => address.strip).includes(:preference).first
|
||||
if user.nil?
|
||||
user = User.where("preferences.sms_email" => address.strip[1.100]).includes(:preference).first
|
||||
end
|
||||
Rails.logger.info(!user.nil? ? "Email belongs to #{user.login}" : "User unknown")
|
||||
end
|
||||
return user
|
||||
end
|
||||
|
|
|
|||
|
|
@ -100,18 +100,24 @@
|
|||
If Tracks is running on the same server as your mail server, you can use the integrated mail handler built into tracks. Steps to set it up:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Go to <%= link_to t('layouts.navigation.preferences'), preferences_url %>
|
||||
and set your "<%= Preference.human_attribute_name('sms_email') %>" and
|
||||
<li>Go to <%= link_to t('layouts.navigation.preferences'), preferences_url %> and
|
||||
set your "<%= Preference.human_attribute_name('sms_email') %>" and
|
||||
"<%= Preference.human_attribute_name('sms_context') %>" for todos sent in
|
||||
via email (which could come from an SMS message)</li>
|
||||
<li>In sendmail/qmail/postfix/whatever, set up an email address alias
|
||||
to pipe messages to <pre>/PATH/TO/RUBY/ruby /PATH/TO/TRACKS/script/runner -e production 'MessageGateway.receive(STDIN.read)'</pre></li>
|
||||
<li>In sendmail/qmail/postfix/whatever, set up an email address
|
||||
alias to pipe messages to <pre>/usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre></li>
|
||||
<li>Send an email to your newly configured address!</li>
|
||||
</ul>
|
||||
<p>You can also use the Rich Todo API to send in tasks like "do laundry @ Home"
|
||||
or "Call Bill > project X". The subject of the message will fill description,
|
||||
context, and project, while the body will populate the tasks's note.
|
||||
</p>
|
||||
<p>
|
||||
You may need to configure your <tt>site.yml</tt> to tell the message gateway to look at the <tt>to:</tt> field or <tt>from:</tt> field to
|
||||
lookup Tracks' user from the email address in that field. </p>
|
||||
<p>You can also send all email to a specific Tracks user. Configure mail_dispatch in site.yml to <tt>single_user</tt> and pass the login of the user:
|
||||
<pre>TRACKS_MAIL_RECEIVER=<%=current_user.login%> usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre>
|
||||
</p>
|
||||
|
||||
<a name="google_gadget"> </a>
|
||||
<h2>Add Tracks as a Google Gmail gadget</h2>
|
||||
|
|
|
|||
|
|
@ -105,13 +105,19 @@
|
|||
"<%= Preference.human_attribute_name('sms_context') %>" for todos sent in
|
||||
via email (which could come from an SMS message)</li>
|
||||
<li>In sendmail/qmail/postfix/whatever, set up an email address
|
||||
alias to pipe messages to <pre>/PATH/TO/RUBY/ruby /PATH/TO/TRACKS/script/runner -e production 'MessageGateway.receive(STDIN.read)'</pre></li>
|
||||
alias to pipe messages to <pre>/usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre></li>
|
||||
<li>Send an email to your newly configured address!</li>
|
||||
</ul>
|
||||
<p>You can also use the Rich Todo API to send in tasks like "do laundry @ Home"
|
||||
or "Call Bill > project X". The subject of the message will fill description,
|
||||
context, and project, while the body will populate the tasks's note.
|
||||
</p>
|
||||
<p>
|
||||
You may need to configure your <tt>site.yml</tt> to tell the message gateway to look at the <tt>to:</tt> field or <tt>from:</tt> field to
|
||||
lookup Tracks' user from the email address in that field. </p>
|
||||
<p>You can also send all email to a specific Tracks user. Configure mail_dispatch in site.yml to <tt>single_user</tt> and pass the login of the user:
|
||||
<pre>TRACKS_MAIL_RECEIVER=<%=current_user.login%> usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre>
|
||||
</p>
|
||||
|
||||
<a name="google_gadget"> </a>
|
||||
<h2>Add Tracks as a Google Gmail gadget</h2>
|
||||
|
|
|
|||
|
|
@ -109,13 +109,19 @@
|
|||
verzonden zijn via email (die bijv. komen via een SMS message)</li>
|
||||
<li>In sendmail/qmail/postfix/whatever, stel een email address
|
||||
alias in om berichten door te sturen naar
|
||||
<pre>/PATH/TO/RUBY/ruby /PATH/TO/TRACKS/script/runner -e production 'MessageGateway.receive(STDIN.read)'</pre></li>
|
||||
<pre>/usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre></li>
|
||||
<li>Verstuur een email naar het net geconfigureerde e-mail adres!</li>
|
||||
</ul>
|
||||
<p>Je kan ook de Rich Todo API gebruiken om acties te maken zoals "do laundry @ Home"
|
||||
of "Call Bill > project X". Het onderwerp van het bericht zal de bijschrijving van de actie vullen,
|
||||
de context, en het project, terwijl de body van het bericht de notities van de actie zal vullen.
|
||||
</p>
|
||||
<p>
|
||||
Het kan nodig zijn om jouw <tt>site.yml</tt> te configureren om de message gateway te laten kijken naar het <tt>to:</tt> veld of het <tt>from:</tt> veld om
|
||||
de Tracks-gebruiker op te zoeken met het emailadres uit dat veld. </p>
|
||||
<p>Je kan ook alle email naar een specifieke Tracks gebruiker sturen. Stel mail_dispatch in site.yml in op <tt>single_user</tt> en geeft de login van de gebruiker door:
|
||||
<pre>TRACKS_MAIL_RECEIVER=<%=current_user.login%> usr/bin/bundle exec /PATH/TO/TRACKS/script/rails r -e production 'MessageGateway.receive(STDIN.read)'</pre>
|
||||
</p>
|
||||
|
||||
<a name="google_gadget"> </a>
|
||||
<h2>Voeg tracks toe als een Google Gmail gadget</h2>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue