View source code
Display the source code in std/net/curl.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Struct std.net.curl.SMTP
Basic SMTP protocol support.
struct SMTP
;
Properties
Name | Type | Description |
---|---|---|
connectTimeout [set]
|
Duration | Set timeout for connecting. |
dataTimeout [set]
|
Duration | Set timeout for activity on connection. |
dnsTimeout [set]
|
Duration | DNS lookup timeout. |
isStopped [get]
|
bool | True if the instance is stopped. A stopped instance is not usable. |
localPort [set]
|
ushort | Set the local outgoing port to use. |
localPortRange [set]
|
ushort | Set the local outgoing port range to use. This can be used together with the localPort property. |
mailFrom [set]
|
const(char)[] | Setter for the sender's email address. |
message [set]
|
string | Sets the message body text. |
netInterface [set]
|
const(char)[] | The network interface to use in form of the the IP of the interface. |
onProgress [set]
|
int delegate(ulong, ulong, ulong, ulong) | The event handler that gets called to inform of upload/download progress. |
onReceive [set]
|
ulong delegate(ubyte[]) | The event handler that receives incoming data. Be sure to copy the incoming ubyte[] since it is not guaranteed to be valid after the callback returns. |
onSend [set]
|
ulong delegate(void[]) | The event handler that gets called when data is needed for sending. The
length of the void[] specifies the maximum number of bytes that can
be sent.
|
operationTimeout [set]
|
Duration | Set maximum time an operation is allowed to take. This includes dns resolution, connecting, data transfer, etc. |
proxy [set]
|
const(char)[] | Proxy |
proxyPort [set]
|
ushort | Proxy port |
proxyType [set]
|
CurlProxy | Proxy type |
tcpNoDelay [set]
|
bool | Set the tcp no-delay socket option on or off. |
url [set]
|
const(char)[] | The URL to specify the location of the resource. |
verbose [set]
|
bool | Set verbose. This will print request information to stderr. |
Methods
Name | Description |
---|---|
mailTo
()
|
Setter for the recipient email addresses. |
opCall
(url)
|
Sets to the URL of the SMTP server. |
opCall
()
|
|
perform
(throwOnError)
|
Performs the request as configured. |
setAuthentication
(username, password, domain)
|
Set the user name, password and optionally domain for authentication purposes. |
setProxyAuthentication
(username, password)
|
Set the user name and password for proxy authentication. |
shutdown
()
|
Stop and invalidate this instance. |
Aliases
Name | Description |
---|---|
CurlProxy
|
Type of proxy |
requestAbort
|
Value to return from onSend delegate in order to abort a request |
requestPause
|
Value to return from onSend /onReceive delegates in order to
pause a request
|
Example
import std .net .curl;
// Send an email with SMTPS
auto smtp = SMTP("smtps://smtp.gmail.com");
smtp .setAuthentication("[email protected]", "password");
smtp .mailTo = ["<[email protected]>"];
smtp .mailFrom = "<[email protected]>";
smtp .message = "Example Message";
smtp .perform();
See Also
Authors
Jonas Drewsen. Some of the SMTP code contributed by Jimmy Cao.
License
Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.