Documentation ¶
Overview ¶
Package directEmail support direct send email from selected interface include SOCKS5 proxy server
Index ¶
- type Connect
- type Email
- func (slf *Email) Attachment(files ...string) (err error)
- func (slf *Email) GetRawMessageBytes() []byte
- func (slf *Email) GetRawMessageString() string
- func (slf *Email) Header(headers ...string)
- func (slf *Email) Render() (err error)
- func (slf *Email) RenderWithDkim(dkimSelector string, dkimPrivateKey []byte) (err error)
- func (self *Email) Send() error
- func (self *Email) SendThroughServer(host string, port uint16, username, password string) error
- func (slf *Email) SetInterfaceByIp(ip string)
- func (slf *Email) SetInterfaceByName(name string) error
- func (slf *Email) SetInterfaceDefault(ip string)
- func (slf *Email) SetInterfaceSocks(server string, port int)
- func (slf *Email) SetMapGlobalIpForLocal(globalIp, localIp string)
- func (slf *Email) SetRawMessageBytes(data []byte) error
- func (slf *Email) SetRawMessageString(data string) error
- func (slf *Email) TextHtml(content string) (err error)
- func (slf *Email) TextHtmlWithRelated(content string, files ...string) (err error)
- func (slf *Email) TextPlain(content string) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connect ¶
type Connect struct {
// contains filtered or unexported fields
}
Connect to smtp server from configured interface
func (*Connect) SetHostName ¶
SetHostName set server hostname for HELO. If left blanc then use resolv name.
func (*Connect) SetIface ¶
SetIface use this Iface for send. Default use default interface. Example:
IP "1.2.3.4" Socks5 proxy "socks5://user:password@1.2.3.4" or "socks5://1.2.3.4"
func (*Connect) SetSMTPport ¶
SetSMTPport set SMTP server port. Default 25 use for translate local Iface to global if NAT if use Socks server translate Iface SOCKS server to real Iface
type Email ¶
type Email struct { // Ip contains local IP address wich use for send email // if blank use default interface // if use socks5 proxy "socks://123.124.125.126:8080" // and with auth "socks://user:password@123.124.125.126:8080" Ip string // Host is host name // if blank use DNS resolv for field fill Host string // Port SMTP server port Port uint16 // MapIp use for translate local IP to global if NAT // if use Socks server translate IP SOCKS server to real IP MapIp map[string]string // FromEmail sender email (Required) FromEmail string // FromName sender name FromName string // ToEmail recipient email (Required) ToEmail string // ToName recipient name ToName string // Subject email subject Subject string // contains filtered or unexported fields }
A Email contains options for send email.
func (*Email) Attachment ¶
Attachment attach files to email message
func (*Email) GetRawMessageString ¶
GetRawMessageString
func (*Email) RenderWithDkim ¶
Render added text/html, text/plain, attachments part to raw view If dkim selector not blank add DKIM signature email Generate private key:
openssl genrsa -out /path/to/key/example.com.key 2048
Generate public key:
openssl rsa -in /path/to/key/example.com.key -pubout
Add public key to DNS myselector._domainkey.example.com TXT record
k=rsa; p=MIGfMA0GC...
func (*Email) SendThroughServer ¶
SendThroughServer send email from SMTP server
func (*Email) SetInterfaceByIp ¶
SetInterfaceByIp set IP from which the sending will be made
func (*Email) SetInterfaceByName ¶
SetInterfaceByName set interface from which the sending will be made
func (*Email) SetInterfaceDefault ¶
SetInterfaceDefault set default interface for sending
func (*Email) SetInterfaceSocks ¶
// SetInterfaceBySocks set SOCKS server through which the sending will be made
func (*Email) SetMapGlobalIpForLocal ¶
SetMapGlobalIpForLocal set glibal IP for local IP address
func (*Email) SetRawMessageBytes ¶
SetRawMessageBytes
func (*Email) SetRawMessageString ¶
SetRawMessageString
func (*Email) TextHtmlWithRelated ¶
TextHtmlWithRelated add text/html content with related file.
Example use file in html
email.TextHtmlWithRelated( `... <img src="cid:myImage.jpg" width="500px" height="250px" border="1px" alt="My image"/> ...`, "/path/to/attach/myImage.jpg", )