You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

727 lines
24 KiB

8 years ago
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta name="theme-color" content="#375EAB">
  7. <title>smtp - The Go Programming Language</title>
  8. <link type="text/css" rel="stylesheet" href="../../../lib/godoc/style.css">
  9. <link rel="stylesheet" href="../../../lib/godoc/jquery.treeview.css">
  10. <script type="text/javascript">window.initFuncs = [];</script>
  11. </head>
  12. <body>
  13. <div id='lowframe' style="position: fixed; bottom: 0; left: 0; height: 0; width: 100%; border-top: thin solid grey; background-color: white; overflow: auto;">
  14. ...
  15. </div><!-- #lowframe -->
  16. <div id="topbar" class="wide"><div class="container">
  17. <div class="top-heading" id="heading-wide"><a href="http://localhost:6060/">The Go Programming Language</a></div>
  18. <div class="top-heading" id="heading-narrow"><a href="http://localhost:6060/">Go</a></div>
  19. <a href="index.html#" id="menu-button"><span id="menu-button-arrow">&#9661;</span></a>
  20. <form method="GET" action="http://localhost:6060/search">
  21. <div id="menu">
  22. <a href="http://localhost:6060/doc/">Documents</a>
  23. <a href="http://localhost:6060/pkg/">Packages</a>
  24. <a href="http://localhost:6060/project/">The Project</a>
  25. <a href="http://localhost:6060/help/">Help</a>
  26. <a href="http://localhost:6060/blog/">Blog</a>
  27. <input type="text" id="search" name="q" class="inactive" value="Search" placeholder="Search">
  28. </div>
  29. </form>
  30. </div></div>
  31. <div id="page" class="wide">
  32. <div class="container">
  33. <h1>Package smtp</h1>
  34. <div id="nav"></div>
  35. <!--
  36. Copyright 2009 The Go Authors. All rights reserved.
  37. Use of this source code is governed by a BSD-style
  38. license that can be found in the LICENSE file.
  39. -->
  40. <!--
  41. Note: Static (i.e., not template-generated) href and id
  42. attributes start with "pkg-" to make it impossible for
  43. them to conflict with generated attributes (some of which
  44. correspond to Go identifiers).
  45. -->
  46. <script type='text/javascript'>
  47. document.ANALYSIS_DATA = null;
  48. document.CALLGRAPH = null;
  49. </script>
  50. <div id="short-nav">
  51. <dl>
  52. <dd><code>import "net/smtp"</code></dd>
  53. </dl>
  54. <dl>
  55. <dd><a href="index.html#pkg-overview" class="overviewLink">Overview</a></dd>
  56. <dd><a href="index.html#pkg-index" class="indexLink">Index</a></dd>
  57. <dd><a href="index.html#pkg-examples" class="examplesLink">Examples</a></dd>
  58. </dl>
  59. </div>
  60. <!-- The package's Name is printed as title by the top-level template -->
  61. <div id="pkg-overview" class="toggleVisible">
  62. <div class="collapsed">
  63. <h2 class="toggleButton" title="Click to show Overview section">Overview ▹</h2>
  64. </div>
  65. <div class="expanded">
  66. <h2 class="toggleButton" title="Click to hide Overview section">Overview ▾</h2>
  67. <p>
  68. Package smtp implements the Simple Mail Transfer Protocol as defined in RFC 5321.
  69. It also implements the following extensions:
  70. </p>
  71. <pre>8BITMIME RFC 1652
  72. AUTH RFC 2554
  73. STARTTLS RFC 3207
  74. </pre>
  75. <p>
  76. Additional extensions may be handled by clients.
  77. </p>
  78. </div>
  79. </div>
  80. <div id="example_" class="toggle">
  81. <div class="collapsed">
  82. <p class="exampleHeading toggleButton"><span class="text">Example</span></p>
  83. </div>
  84. <div class="expanded">
  85. <p class="exampleHeading toggleButton"><span class="text">Example</span></p>
  86. <p>Code:</p>
  87. <pre class="code">
  88. <span class="comment">// Connect to the remote SMTP server.</span>
  89. c, err := smtp.Dial(&#34;mail.example.com:25&#34;)
  90. if err != nil {
  91. log.Fatal(err)
  92. }
  93. <span class="comment">// Set the sender and recipient first</span>
  94. if err := c.Mail(&#34;sender@example.org&#34;); err != nil {
  95. log.Fatal(err)
  96. }
  97. if err := c.Rcpt(&#34;recipient@example.net&#34;); err != nil {
  98. log.Fatal(err)
  99. }
  100. <span class="comment">// Send the email body.</span>
  101. wc, err := c.Data()
  102. if err != nil {
  103. log.Fatal(err)
  104. }
  105. _, err = fmt.Fprintf(wc, &#34;This is the email body&#34;)
  106. if err != nil {
  107. log.Fatal(err)
  108. }
  109. err = wc.Close()
  110. if err != nil {
  111. log.Fatal(err)
  112. }
  113. <span class="comment">// Send the QUIT command and close the connection.</span>
  114. err = c.Quit()
  115. if err != nil {
  116. log.Fatal(err)
  117. }
  118. </pre>
  119. </div>
  120. </div>
  121. <div id="pkg-index" class="toggleVisible">
  122. <div class="collapsed">
  123. <h2 class="toggleButton" title="Click to show Index section">Index ▹</h2>
  124. </div>
  125. <div class="expanded">
  126. <h2 class="toggleButton" title="Click to hide Index section">Index ▾</h2>
  127. <!-- Table of contents for API; must be named manual-nav to turn off auto nav. -->
  128. <div id="manual-nav">
  129. <dl>
  130. <dd><a href="index.html#SendMail">func SendMail(addr string, a Auth, from string, to []string, msg []byte) error</a></dd>
  131. <dd><a href="index.html#Auth">type Auth</a></dd>
  132. <dd>&nbsp; &nbsp; <a href="index.html#CRAMMD5Auth">func CRAMMD5Auth(username, secret string) Auth</a></dd>
  133. <dd>&nbsp; &nbsp; <a href="index.html#PlainAuth">func PlainAuth(identity, username, password, host string) Auth</a></dd>
  134. <dd><a href="index.html#Client">type Client</a></dd>
  135. <dd>&nbsp; &nbsp; <a href="index.html#Dial">func Dial(addr string) (*Client, error)</a></dd>
  136. <dd>&nbsp; &nbsp; <a href="index.html#NewClient">func NewClient(conn net.Conn, host string) (*Client, error)</a></dd>
  137. <dd>&nbsp; &nbsp; <a href="index.html#Client.Auth">func (c *Client) Auth(a Auth) error</a></dd>
  138. <dd>&nbsp; &nbsp; <a href="index.html#Client.Close">func (c *Client) Close() error</a></dd>
  139. <dd>&nbsp; &nbsp; <a href="index.html#Client.Data">func (c *Client) Data() (io.WriteCloser, error)</a></dd>
  140. <dd>&nbsp; &nbsp; <a href="index.html#Client.Extension">func (c *Client) Extension(ext string) (bool, string)</a></dd>
  141. <dd>&nbsp; &nbsp; <a href="index.html#Client.Hello">func (c *Client) Hello(localName string) error</a></dd>
  142. <dd>&nbsp; &nbsp; <a href="index.html#Client.Mail">func (c *Client) Mail(from string) error</a></dd>
  143. <dd>&nbsp; &nbsp; <a href="index.html#Client.Quit">func (c *Client) Quit() error</a></dd>
  144. <dd>&nbsp; &nbsp; <a href="index.html#Client.Rcpt">func (c *Client) Rcpt(to string) error</a></dd>
  145. <dd>&nbsp; &nbsp; <a href="index.html#Client.Reset">func (c *Client) Reset() error</a></dd>
  146. <dd>&nbsp; &nbsp; <a href="index.html#Client.StartTLS">func (c *Client) StartTLS(config *tls.Config) error</a></dd>
  147. <dd>&nbsp; &nbsp; <a href="index.html#Client.TLSConnectionState">func (c *Client) TLSConnectionState() (state tls.ConnectionState, ok bool)</a></dd>
  148. <dd>&nbsp; &nbsp; <a href="index.html#Client.Verify">func (c *Client) Verify(addr string) error</a></dd>
  149. <dd><a href="index.html#ServerInfo">type ServerInfo</a></dd>
  150. </dl>
  151. </div><!-- #manual-nav -->
  152. <div id="pkg-examples">
  153. <h4>Examples</h4>
  154. <dl>
  155. <dd><a class="exampleLink" href="index.html#example_">Package</a></dd>
  156. <dd><a class="exampleLink" href="index.html#example_PlainAuth">PlainAuth</a></dd>
  157. <dd><a class="exampleLink" href="index.html#example_SendMail">SendMail</a></dd>
  158. </dl>
  159. </div>
  160. <h4>Package files</h4>
  161. <p>
  162. <span style="font-size:90%">
  163. <a href="http://localhost:6060/src/net/smtp/auth.go">auth.go</a>
  164. <a href="http://localhost:6060/src/net/smtp/smtp.go">smtp.go</a>
  165. </span>
  166. </p>
  167. </div><!-- .expanded -->
  168. </div><!-- #pkg-index -->
  169. <div id="pkg-callgraph" class="toggle" style="display: none">
  170. <div class="collapsed">
  171. <h2 class="toggleButton" title="Click to show Internal Call Graph section">Internal call graph ▹</h2>
  172. </div> <!-- .expanded -->
  173. <div class="expanded">
  174. <h2 class="toggleButton" title="Click to hide Internal Call Graph section">Internal call graph ▾</h2>
  175. <p>
  176. In the call graph viewer below, each node
  177. is a function belonging to this package
  178. and its children are the functions it
  179. calls&mdash;perhaps dynamically.
  180. </p>
  181. <p>
  182. The root nodes are the entry points of the
  183. package: functions that may be called from
  184. outside the package.
  185. There may be non-exported or anonymous
  186. functions among them if they are called
  187. dynamically from another package.
  188. </p>
  189. <p>
  190. Click a node to visit that function's source code.
  191. From there you can visit its callers by
  192. clicking its declaring <code>func</code>
  193. token.
  194. </p>
  195. <p>
  196. Functions may be omitted if they were
  197. determined to be unreachable in the
  198. particular programs or tests that were
  199. analyzed.
  200. </p>
  201. <!-- Zero means show all package entry points. -->
  202. <ul style="margin-left: 0.5in" id="callgraph-0" class="treeview"></ul>
  203. </div>
  204. </div> <!-- #pkg-callgraph -->
  205. <h2 id="SendMail">func <a href="http://localhost:6060/src/net/smtp/smtp.go?s=8766:8844#L290">SendMail</a></h2>
  206. <pre>func SendMail(addr <a href="../../builtin/index.html#string">string</a>, a <a href="index.html#Auth">Auth</a>, from <a href="../../builtin/index.html#string">string</a>, to []<a href="../../builtin/index.html#string">string</a>, msg []<a href="../../builtin/index.html#byte">byte</a>) <a href="../../builtin/index.html#error">error</a></pre>
  207. <p>
  208. SendMail connects to the server at addr, switches to TLS if
  209. possible, authenticates with the optional mechanism a if possible,
  210. and then sends an email from address from, to addresses to, with
  211. message msg.
  212. The addr must include a port, as in &#34;mail.example.com:smtp&#34;.
  213. </p>
  214. <p>
  215. The addresses in the to parameter are the SMTP RCPT addresses.
  216. </p>
  217. <p>
  218. The msg parameter should be an RFC 822-style email with headers
  219. first, a blank line, and then the message body. The lines of msg
  220. should be CRLF terminated. The msg headers should usually include
  221. fields such as &#34;From&#34;, &#34;To&#34;, &#34;Subject&#34;, and &#34;Cc&#34;. Sending &#34;Bcc&#34;
  222. messages is accomplished by including an email address in the to
  223. parameter but not including it in the msg headers.
  224. </p>
  225. <p>
  226. The SendMail function and the the net/smtp package are low-level
  227. mechanisms and provide no support for DKIM signing, MIME
  228. attachments (see the mime/multipart package), or other mail
  229. functionality. Higher-level packages exist outside of the standard
  230. library.
  231. </p>
  232. <div id="example_SendMail" class="toggle">
  233. <div class="collapsed">
  234. <p class="exampleHeading toggleButton"><span class="text">Example</span></p>
  235. </div>
  236. <div class="expanded">
  237. <p class="exampleHeading toggleButton"><span class="text">Example</span></p>
  238. <p>Code:</p>
  239. <pre class="code">
  240. <span class="comment">// Set up authentication information.</span>
  241. auth := smtp.PlainAuth(&#34;&#34;, &#34;user@example.com&#34;, &#34;password&#34;, &#34;mail.example.com&#34;)
  242. <span class="comment">// Connect to the server, authenticate, set the sender and recipient,</span>
  243. <span class="comment">// and send the email all in one step.</span>
  244. to := []string{&#34;recipient@example.net&#34;}
  245. msg := []byte(&#34;To: recipient@example.net\r\n&#34; +
  246. &#34;Subject: discount Gophers!\r\n&#34; +
  247. &#34;\r\n&#34; +
  248. &#34;This is the email body.\r\n&#34;)
  249. err := smtp.SendMail(&#34;mail.example.com:25&#34;, auth, &#34;sender@example.org&#34;, to, msg)
  250. if err != nil {
  251. log.Fatal(err)
  252. }
  253. </pre>
  254. </div>
  255. </div>
  256. <h2 id="Auth">type <a href="http://localhost:6060/src/net/smtp/auth.go?s=292:1191#L5">Auth</a></h2>
  257. <pre>type Auth interface {
  258. <span class="comment">// Start begins an authentication with a server.</span>
  259. <span class="comment">// It returns the name of the authentication protocol</span>
  260. <span class="comment">// and optionally data to include in the initial AUTH message</span>
  261. <span class="comment">// sent to the server. It can return proto == &#34;&#34; to indicate</span>
  262. <span class="comment">// that the authentication should be skipped.</span>
  263. <span class="comment">// If it returns a non-nil error, the SMTP client aborts</span>
  264. <span class="comment">// the authentication attempt and closes the connection.</span>
  265. Start(server *<a href="index.html#ServerInfo">ServerInfo</a>) (proto <a href="../../builtin/index.html#string">string</a>, toServer []<a href="../../builtin/index.html#byte">byte</a>, err <a href="../../builtin/index.html#error">error</a>)
  266. <span class="comment">// Next continues the authentication. The server has just sent</span>
  267. <span class="comment">// the fromServer data. If more is true, the server expects a</span>
  268. <span class="comment">// response, which Next should return as toServer; otherwise</span>
  269. <span class="comment">// Next should return toServer == nil.</span>
  270. <span class="comment">// If Next returns a non-nil error, the SMTP client aborts</span>
  271. <span class="comment">// the authentication attempt and closes the connection.</span>
  272. Next(fromServer []<a href="../../builtin/index.html#byte">byte</a>, more <a href="../../builtin/index.html#bool">bool</a>) (toServer []<a href="../../builtin/index.html#byte">byte</a>, err <a href="../../builtin/index.html#error">error</a>)
  273. }</pre>
  274. <p>
  275. Auth is implemented by an SMTP authentication mechanism.
  276. </p>
  277. <h3 id="CRAMMD5Auth">func <a href="http://localhost:6060/src/net/smtp/auth.go?s=2924:2970#L81">CRAMMD5Auth</a></h3>
  278. <pre>func CRAMMD5Auth(username, secret <a href="../../builtin/index.html#string">string</a>) <a href="index.html#Auth">Auth</a></pre>
  279. <p>
  280. CRAMMD5Auth returns an Auth that implements the CRAM-MD5 authentication
  281. mechanism as defined in RFC 2195.
  282. The returned Auth uses the given username and secret to authenticate
  283. to the server using the challenge-response mechanism.
  284. </p>
  285. <h3 id="PlainAuth">func <a href="http://localhost:6060/src/net/smtp/auth.go?s=1820:1882#L41">PlainAuth</a></h3>
  286. <pre>func PlainAuth(identity, username, password, host <a href="../../builtin/index.html#string">string</a>) <a href="index.html#Auth">Auth</a></pre>
  287. <p>
  288. PlainAuth returns an Auth that implements the PLAIN authentication
  289. mechanism as defined in RFC 4616.
  290. The returned Auth uses the given username and password to authenticate
  291. on TLS connections to host and act as identity. Usually identity will be
  292. left blank to act as username.
  293. </p>
  294. <div id="example_PlainAuth" class="toggle">
  295. <div class="collapsed">
  296. <p class="exampleHeading toggleButton"><span class="text">Example</span></p>
  297. </div>
  298. <div class="expanded">
  299. <p class="exampleHeading toggleButton"><span class="text">Example</span></p>
  300. <p>Code:</p>
  301. <pre class="code">
  302. <span class="comment">// hostname is used by PlainAuth to validate the TLS certificate.</span>
  303. hostname := &#34;mail.example.com&#34;
  304. auth := smtp.PlainAuth(&#34;&#34;, &#34;user@example.com&#34;, &#34;password&#34;, hostname)
  305. err := smtp.SendMail(hostname+&#34;:25&#34;, auth, from, recipients, msg)
  306. if err != nil {
  307. log.Fatal(err)
  308. }
  309. </pre>
  310. </div>
  311. </div>
  312. <h2 id="Client">type <a href="http://localhost:6060/src/net/smtp/smtp.go?s=583:1173#L14">Client</a></h2>
  313. <pre>type Client struct {
  314. <span class="comment">// Text is the textproto.Conn used by the Client. It is exported to allow for</span>
  315. <span class="comment">// clients to add extensions.</span>
  316. Text *<a href="../textproto/index.html">textproto</a>.<a href="../textproto/index.html#Conn">Conn</a>
  317. <span class="comment">// contains filtered or unexported fields</span>
  318. }</pre>
  319. <p>
  320. A Client represents a client connection to an SMTP server.
  321. </p>
  322. <h3 id="Dial">func <a href="http://localhost:6060/src/net/smtp/smtp.go?s=1305:1344#L35">Dial</a></h3>
  323. <pre>func Dial(addr <a href="../../builtin/index.html#string">string</a>) (*<a href="index.html#Client">Client</a>, <a href="../../builtin/index.html#error">error</a>)</pre>
  324. <p>
  325. Dial returns a new Client connected to an SMTP server at addr.
  326. The addr must include a port, as in &#34;mail.example.com:smtp&#34;.
  327. </p>
  328. <h3 id="NewClient">func <a href="http://localhost:6060/src/net/smtp/smtp.go?s=1617:1676#L46">NewClient</a></h3>
  329. <pre>func NewClient(conn <a href="../index.html">net</a>.<a href="../index.html#Conn">Conn</a>, host <a href="../../builtin/index.html#string">string</a>) (*<a href="index.html#Client">Client</a>, <a href="../../builtin/index.html#error">error</a>)</pre>
  330. <p>
  331. NewClient returns a new Client using an existing connection and host as a
  332. server name to be used when authenticating.
  333. </p>
  334. <h3 id="Client.Auth">func (*Client) <a href="http://localhost:6060/src/net/smtp/smtp.go?s=5280:5315#L176">Auth</a></h3>
  335. <pre>func (c *<a href="index.html#Client">Client</a>) Auth(a <a href="index.html#Auth">Auth</a>) <a href="../../builtin/index.html#error">error</a></pre>
  336. <p>
  337. Auth authenticates a client using the provided authentication mechanism.
  338. A failed authentication closes the connection.
  339. Only servers that advertise the AUTH extension support this function.
  340. </p>
  341. <h3 id="Client.Close">func (*Client) <a href="http://localhost:6060/src/net/smtp/smtp.go?s=1932:1962#L58">Close</a></h3>
  342. <pre>func (c *<a href="index.html#Client">Client</a>) Close() <a href="../../builtin/index.html#error">error</a></pre>
  343. <p>
  344. Close closes the connection.
  345. </p>
  346. <h3 id="Client.Data">func (*Client) <a href="http://localhost:6060/src/net/smtp/smtp.go?s=7505:7552#L260">Data</a></h3>
  347. <pre>func (c *<a href="index.html#Client">Client</a>) Data() (<a href="../../io/index.html">io</a>.<a href="../../io/index.html#WriteCloser">WriteCloser</a>, <a href="../../builtin/index.html#error">error</a>)</pre>
  348. <p>
  349. Data issues a DATA command to the server and returns a writer that
  350. can be used to write the mail headers and body. The caller should
  351. close the writer before calling any more methods on c. A call to
  352. Data must be preceded by one or more calls to Rcpt.
  353. </p>
  354. <h3 id="Client.Extension">func (*Client) <a href="http://localhost:6060/src/net/smtp/smtp.go?s=9885:9938#L342">Extension</a></h3>
  355. <pre>func (c *<a href="index.html#Client">Client</a>) Extension(ext <a href="../../builtin/index.html#string">string</a>) (<a href="../../builtin/index.html#bool">bool</a>, <a href="../../builtin/index.html#string">string</a>)</pre>
  356. <p>
  357. Extension reports whether an extension is support by the server.
  358. The extension name is case-insensitive. If the extension is supported,
  359. Extension also returns a string that contains any parameters the
  360. server specifies for the extension.
  361. </p>
  362. <h3 id="Client.Hello">func (*Client) <a href="http://localhost:6060/src/net/smtp/smtp.go?s=2515:2561#L79">Hello</a></h3>
  363. <pre>func (c *<a href="index.html#Client">Client</a>) Hello(localName <a href="../../builtin/index.html#string">string</a>) <a href="../../builtin/index.html#error">error</a></pre>
  364. <p>
  365. Hello sends a HELO or EHLO to the server as the given host name.
  366. Calling this method is only necessary if the client needs control
  367. over the host name used. The client will introduce itself as &#34;localhost&#34;
  368. automatically otherwise. If Hello is called, it must be called before
  369. any of the other methods.
  370. </p>
  371. <h3 id="Client.Mail">func (*Client) <a href="http://localhost:6060/src/net/smtp/smtp.go?s=6510:6550#L223">Mail</a></h3>
  372. <pre>func (c *<a href="index.html#Client">Client</a>) Mail(from <a href="../../builtin/index.html#string">string</a>) <a href="../../builtin/index.html#error">error</a></pre>
  373. <p>
  374. Mail issues a MAIL command to the server using the provided email address.
  375. If the server supports the 8BITMIME extension, Mail adds the BODY=8BITMIME
  376. parameter.
  377. This initiates a mail transaction and is followed by one or more Rcpt calls.
  378. </p>
  379. <h3 id="Client.Quit">func (*Client) <a href="http://localhost:6060/src/net/smtp/smtp.go?s=10406:10435#L365">Quit</a></h3>
  380. <pre>func (c *<a href="index.html#Client">Client</a>) Quit() <a href="../../builtin/index.html#error">error</a></pre>
  381. <p>
  382. Quit sends the QUIT command and closes the connection to the server.
  383. </p>
  384. <h3 id="Client.Rcpt">func (*Client) <a href="http://localhost:6060/src/net/smtp/smtp.go?s=6971:7009#L240">Rcpt</a></h3>
  385. <pre>func (c *<a href="index.html#Client">Client</a>) Rcpt(to <a href="../../builtin/index.html#string">string</a>) <a href="../../builtin/index.html#error">error</a></pre>
  386. <p>
  387. Rcpt issues a RCPT command to the server using the provided email address.
  388. A call to Rcpt must be preceded by a call to Mail and may be followed by
  389. a Data call or another Rcpt call.
  390. </p>
  391. <h3 id="Client.Reset">func (*Client) <a href="http://localhost:6060/src/net/smtp/smtp.go?s=10202:10232#L356">Reset</a></h3>
  392. <pre>func (c *<a href="index.html#Client">Client</a>) Reset() <a href="../../builtin/index.html#error">error</a></pre>
  393. <p>
  394. Reset sends the RSET command to the server, aborting the current mail
  395. transaction.
  396. </p>
  397. <h3 id="Client.StartTLS">func (*Client) <a href="http://localhost:6060/src/net/smtp/smtp.go?s=4092:4143#L136">StartTLS</a></h3>
  398. <pre>func (c *<a href="index.html#Client">Client</a>) StartTLS(config *<a href="../../crypto/tls/index.html">tls</a>.<a href="../../crypto/tls/index.html#Config">Config</a>) <a href="../../builtin/index.html#error">error</a></pre>
  399. <p>
  400. StartTLS sends the STARTTLS command and encrypts all further communication.
  401. Only servers that advertise the STARTTLS extension support this function.
  402. </p>
  403. <h3 id="Client.TLSConnectionState">func (*Client) <a href="http://localhost:6060/src/net/smtp/smtp.go?s=4514:4588#L153">TLSConnectionState</a></h3>
  404. <pre>func (c *<a href="index.html#Client">Client</a>) TLSConnectionState() (state <a href="../../crypto/tls/index.html">tls</a>.<a href="../../crypto/tls/index.html#ConnectionState">ConnectionState</a>, ok <a href="../../builtin/index.html#bool">bool</a>)</pre>
  405. <p>
  406. TLSConnectionState returns the client&#39;s TLS connection state.
  407. The return values are their zero values if StartTLS did
  408. not succeed.
  409. </p>
  410. <h3 id="Client.Verify">func (*Client) <a href="http://localhost:6060/src/net/smtp/smtp.go?s=4928:4970#L165">Verify</a></h3>
  411. <pre>func (c *<a href="index.html#Client">Client</a>) Verify(addr <a href="../../builtin/index.html#string">string</a>) <a href="../../builtin/index.html#error">error</a></pre>
  412. <p>
  413. Verify checks the validity of an email address on the server.
  414. If Verify returns nil, the address is valid. A non-nil return
  415. does not necessarily indicate an invalid address. Many servers
  416. will not verify addresses for security reasons.
  417. </p>
  418. <h2 id="ServerInfo">type <a href="http://localhost:6060/src/net/smtp/auth.go?s=1249:1426#L25">ServerInfo</a></h2>
  419. <pre>type ServerInfo struct {
  420. Name <a href="../../builtin/index.html#string">string</a> <span class="comment">// SMTP server name</span>
  421. TLS <a href="../../builtin/index.html#bool">bool</a> <span class="comment">// using TLS, with valid certificate for Name</span>
  422. Auth []<a href="../../builtin/index.html#string">string</a> <span class="comment">// advertised authentication mechanisms</span>
  423. }</pre>
  424. <p>
  425. ServerInfo records information about an SMTP server.
  426. </p>
  427. <div id="footer">
  428. Build version go1.6.<br>
  429. Except as <a href="https://developers.google.com/site-policies#restrictions">noted</a>,
  430. the content of this page is licensed under the
  431. Creative Commons Attribution 3.0 License,
  432. and code is licensed under a <a href="http://localhost:6060/LICENSE">BSD license</a>.<br>
  433. <a href="http://localhost:6060/doc/tos.html">Terms of Service</a> |
  434. <a href="http://www.google.com/intl/en/policies/privacy/">Privacy Policy</a>
  435. </div>
  436. </div><!-- .container -->
  437. </div><!-- #page -->
  438. <!-- TODO(adonovan): load these from <head> using "defer" attribute? -->
  439. <script type="text/javascript" src="../../../lib/godoc/jquery.js"></script>
  440. <script type="text/javascript" src="../../../lib/godoc/jquery.treeview.js"></script>
  441. <script type="text/javascript" src="../../../lib/godoc/jquery.treeview.edit.js"></script>
  442. <script type="text/javascript" src="../../../lib/godoc/godocs.js"></script>
  443. </body>
  444. </html>