Commit Graph

61 Commits (362100023cc4fffbe053fc69bd8dd7252a30a0e3)

Author SHA1 Message Date
kolaente f9ec2f89f2 Add golangci ()
zeripath 827ab6b75a Add SUBJECT_PREFIX mailer config option ()
* Add SUBJECT_PREFIX mailer config option

* Add space between subject prefix and subject (Change from Gogs)

Signed-off-by: Andrew Thornton <art27@cantab.net>
mrsdizzie 54c1cb6c5f Add X-Auto-Response-Suppress header to outgoing messages ()
This is a header used to suggest mail servers not to respond to a message
with an auto-responder:

 https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcmail/ced68690-498a-4567-9d14-5c01f974d8b1

This header is also used by github and gitlab in outgoing messages.

Fixes 
zeripath 704da08fdc
Better logging () ()
* Panic don't fatal on create new logger

Fixes 

Signed-off-by: Andrew Thornton <art27@cantab.net>

* partial broken

* Update the logging infrastrcture

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Reset the skip levels for Fatal and Error

Signed-off-by: Andrew Thornton <art27@cantab.net>

* broken ncsa

* More log.Error fixes

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Remove nal

* set log-levels to lowercase

* Make console_test test all levels

* switch to lowercased levels

* OK now working

* Fix vetting issues

* Fix lint

* Fix tests

* change default logging to match current gitea

* Improve log testing

Signed-off-by: Andrew Thornton <art27@cantab.net>

* reset error skip levels to 0

* Update documentation and access logger configuration

* Redirect the router log back to gitea if redirect macaron log but also allow setting the log level - i.e. TRACE

* Fix broken level caching

* Refactor the router log

* Add Router logger

* Add colorizing options

* Adjust router colors

* Only create logger if they will be used

* update app.ini.sample

* rename Attribute ColorAttribute

* Change from white to green for function

* Set fatal/error levels

* Restore initial trace logger

* Fix Trace arguments in modules/auth/auth.go

* Properly handle XORMLogger

* Improve admin/config page

* fix fmt

* Add auto-compression of old logs

* Update error log levels

* Remove the unnecessary skip argument from Error, Fatal and Critical

* Add stacktrace support

* Fix tests

* Remove x/sync from vendors?

* Add stderr option to console logger

* Use filepath.ToSlash to protect against Windows in tests

* Remove prefixed underscores from names in colors.go

* Remove not implemented database logger

This was removed from Gogs on 4 Mar 2016 but left in the configuration
since then.

* Ensure that log paths are relative to ROOT_PATH

* use path.Join

* rename jsonConfig to logConfig

* Rename "config" to "jsonConfig" to make it clearer

* Requested changes

* Requested changes: XormLogger

* Try to color the windows terminal

If successful default to colorizing the console logs

* fixup

* Colorize initially too

* update vendor

* Colorize logs on default and remove if this is not a colorizing logger

* Fix documentation

* fix test

* Use go-isatty to detect if on windows we are on msys or cygwin

* Fix spelling mistake

* Add missing vendors

* More changes

* Rationalise the ANSI writer protection

* Adjust colors on advice from @0x5c

* Make Flags a comma separated list

* Move to use the windows constant for ENABLE_VIRTUAL_TERMINAL_PROCESSING

* Ensure matching is done on the non-colored message - to simpify EXPRESSION
zeripath 3d91bb2f2d Make log mailer for testing ()
* Create log mailer for testing email settings

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Switch on the log mailer for the integration tests

This ensures that the sending mail process works

Signed-off-by: Andrew Thornton <art27@cantab.net>

* rename the from user for mysql/mssql

* rename log sender to dummy sender

* update the integration tests
Lanre Adelowo 3a1ed82529 Explicitly decide whether to use TLS in mailer's configuration ()
* explicitly decide on using TLS for mail connections

* explicitly decide on using TLS for mail connections

* keep compatibility
Jonas Bröms e86a0bf3fe Add support for extra sendmail arguments ()
* Add support for extra sendmail arguments

* Sendmail args to exec.command should be a list

* Add go-shellquote package

* Use go-shellquote lib for parsing Sendmail args

* Only parse if sendmail is configured
Rémi Saurel 66bc0ac251 Fix sending mail with a non-latin display name. ()
* Fix sending mail with a non-latin display name. 

Signed-off-by: Rémi Saurel <contact@remi-saurel.com>

* Take into account the possibility that setting.MailService.From is in `name <email@address>` format. 

Signed-off-by: Rémi Saurel <contact@remi-saurel.com>
Jonas Östanbäck eab4579e17 Fix fmt error in mailer ()
Jonas Östanbäck 01d7189c2d Fix slice out of bounds error in mailer ()
Bo-Yi Wu b7812be33a fix misspell ()
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Jonas Östanbäck d9a8eff2de Send mails as HTML as default. Setting for send as plain text. ()
* Send mails as HTML as default. Setting for send as plain text.
 * Add new option SendAsPlainText. remove EnableHTMLAlternative
 * Send HTML mails as default
 * Add html check if html2text should be performed

* Send only multipart or plain. Add deprication warning for ENABLE_HTML_ALTERNATIVE

* Still use ENABLE_HTML_ALTERNATIVE for backward compatibility

* Changed to not ignore html2text errors
Ethan Koenig 021904e4e6 Fix typos in models/ and modules/ ()
Gabriel Jackson bf6f61cc69 Cleanup log messaging
This change corrects a few logging issues:

 * Standardized formatting errors with '%v'.
 * Standardized failure warning word usage.
 * Corrected an instance of using the standard log library when
   the gitea log library should be used instead.
Bo-Yi Wu 6510e57758 fix gofmt error
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Philip Couling d4924d45d6 Implement sendmail ()
* Implemented sendmail. This piggybacks on existing configuration to keep the change simple

* Changed privicy of new sendSMTP and sendSendmail functions

* Fixed Lint errors

* Seperated SMTP and sendmail into their own senders

* Making new structs private as they should not be used externally now

* Added sendmail setting to ini file

* Minor code cleanup
Lunny Xiao 2e565bc1c4 Golint fixed for modules/mailer
Sandro Santilli 4247304f5a Update import paths from github.com/go-gitea to code.gitea.io ()
- Update import paths from github.com/go-gitea to code.gitea.io
- Fix import path for travis

See https://docs.travis-ci.com/user/languages/go#Go-Import-Path
Rémy Boulanouar 2d68bd1ef9 Change import reference to match gitea instead of gogs ()
Unknwon 62b0dc4853 Web editor: fix cannot create new file in subdirectory
Unknwon f1b8d52eb3 fix no mail notification when issue is closed/reopened
Unknwon 0240f520ab minor fix for when to set HTML alternative
Unknwon 8df3ba96f3 use text/plain as default email content format
Sandro Santilli d35a1c30f4 Do not write HTML in text/plain mail part ()
* Do not write HTML in text/plain mail part

Fixes 

* Pass text/plain first, text/html second

* Do not send plain/text email if html2text failed (untested)
Unknwon 926e75d721 strip whitespace for migrate URL
Also fix a possible race condition while install
Unknwon 2d3ecbe5b2 make mailer log more verbose
Unknwon 373731f5e8 user gomail and new activate account email tpl
- : fallback plain text
- : add date header
- : fix encoding of header
Unknwon e75fd2f783 simplify names
Unknwon b003b18788 Using commas to delineate emails
Hongcai Deng fbb3486c95 fix syntax error
Hongcai Deng 7b92dc3d9d implemented
Unknwon d7c3c79c00 minor fix on
Yixin Hao d720c92d99 Added supported of 'AUTH LOGIN'
i've been missing a 'r' in previous, lol~
Unknwon c47afdff58 add config options for HELO
无闻 3db80f2c55 Merge pull request from diseaz/mailer-client-cert
Use client certificate for SMTP over TLS
Gogs 2f1369c614 add error for hello func
Gogs 5293ae1221 Fix: 504 5.5.2 <localhost>: Helo command rejected
Dmitry Azhichakov 3aaf292ba8 Fix "forcing" client certificate for SMTP
Dmitry Azhichakov 8a6c86644e New feature: SMTP connection may use client certificate.
New config keys in [mailer] section:
 - CERT_FILE: path to a certificate file.
 - KEY_FILE: path to a key file.
Unknwon bd555551ce fix
无闻 030b3d751e Merge pull request from phsmit/correct_from
Correct usage of FROM in email creation
Peter c884ecfea1 Parse the from string to extract the email address
Peter edbe1de026 Remove unused "User" member of Message Struct and fix bounce address
The User member of a message is not needed anymore.

The from that is send to the server, should always be the "system" from. This is also called the Bounce address http://en.wikipedia.org/wiki/Bounce_address
Peter 2321b4b272 Change from header in email, fixes
Peter 007cf33e88 Remove standard mailer port lines
This lines got committed by accident. They do actually nothing, as SplitHostPort will give an error if port is not given.
Unknwon b231b8c927 update locale and mirror code format
Peter eca42bcb44 Prefer CRAM-MD5 over PLAIN authentication
Peter 5ffeca35e7 Add option to use CRAM-MD5 as authentication method in the mailer
Peter 87be137b88 Rewrite of SendMail function
The SendMail function is rewritten and has the following new functionality:
 - It is optional to skip verification of keys. The config option SKIP_VERIFY is added
 - If the port is 465, or ending on 465, the TLS(/SSL) connection is started first.
Alukardd 21081836ba Allow send mail without authentication if SMTP server allow this