mailer

package
v1.17.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 38 Imported by: 9

Documentation

Index

Constants

View Source
const (
	// MailBatchSize set the batch size used in mailIssueCommentBatch
	MailBatchSize = 100
)

Variables

View Source
var Sender gomail.Sender

Sender sender for sending mail synchronously

Functions

func InitMailRender

func InitMailRender(subjectTpl *texttmpl.Template, bodyTpl *template.Template)

InitMailRender initializes the mail renderer

func LoginAuth

func LoginAuth(username, password string) smtp.Auth

LoginAuth SMTP AUTH LOGIN Auth Handler

func MailMentionsComment added in v1.13.2

func MailMentionsComment(ctx context.Context, pr *issues_model.PullRequest, c *issues_model.Comment, mentions []*user_model.User) (err error)

MailMentionsComment sends email to users mentioned in a code comment

func MailNewRelease added in v1.13.0

func MailNewRelease(ctx context.Context, rel *models.Release)

MailNewRelease send new release notify to all all repo watchers.

func MailParticipants

func MailParticipants(issue *issues_model.Issue, doer *user_model.User, opType models.ActionType, mentions []*user_model.User) error

MailParticipants sends new issue thread created emails to repository watchers and mentioned people.

func MailParticipantsComment

func MailParticipantsComment(ctx context.Context, c *issues_model.Comment, opType models.ActionType, issue *issues_model.Issue, mentions []*user_model.User) error

MailParticipantsComment sends new comment emails to repository watchers and mentioned people.

func NewContext

func NewContext()

NewContext start mail queue service

func SendActivateAccountMail

func SendActivateAccountMail(locale translation.Locale, u *user_model.User)

SendActivateAccountMail sends an activation mail to the user (new user registration)

func SendActivateEmailMail

func SendActivateEmailMail(u *user_model.User, email *user_model.EmailAddress)

SendActivateEmailMail sends confirmation email to confirm new email address

func SendAsync

func SendAsync(msg *Message)

SendAsync send mail asynchronously

func SendAsyncs added in v1.11.0

func SendAsyncs(msgs []*Message)

SendAsyncs send mails asynchronously

func SendCollaboratorMail

func SendCollaboratorMail(u, doer *user_model.User, repo *repo_model.Repository)

SendCollaboratorMail sends mail notification to new collaborator.

func SendIssueAssignedMail added in v1.11.0

func SendIssueAssignedMail(issue *issues_model.Issue, doer *user_model.User, content string, comment *issues_model.Comment, recipients []*user_model.User) error

SendIssueAssignedMail composes and sends issue assigned email

func SendRegisterNotifyMail

func SendRegisterNotifyMail(u *user_model.User)

SendRegisterNotifyMail triggers a notify e-mail by admin created a account.

func SendRepoTransferNotifyMail added in v1.14.0

func SendRepoTransferNotifyMail(doer, newOwner *user_model.User, repo *repo_model.Repository) error

SendRepoTransferNotifyMail triggers a notification e-mail when a pending repository transfer was created

func SendResetPasswordMail

func SendResetPasswordMail(u *user_model.User)

SendResetPasswordMail sends a password reset mail to the user

func SendTestMail

func SendTestMail(email string) error

SendTestMail sends a test mail

Types

type Message

type Message struct {
	Info            string // Message information for log purpose.
	FromAddress     string
	FromDisplayName string
	To              []string
	Subject         string
	Date            time.Time
	Body            string
	Headers         map[string][]string
}

Message mail body and log info

func NewMessage

func NewMessage(to []string, subject, body string) *Message

NewMessage creates new mail message object with default From header.

func NewMessageFrom

func NewMessageFrom(to []string, fromDisplayName, fromAddress, subject, body string) *Message

NewMessageFrom creates new mail message object with custom From header.

func (*Message) SetHeader added in v1.12.0

func (m *Message) SetHeader(field string, value ...string)

SetHeader adds additional headers to a message

func (*Message) ToMessage added in v1.12.0

func (m *Message) ToMessage() *gomail.Message

ToMessage converts a Message to gomail.Message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL