{
    "mode": "perldoc",
    "parameter": "Mail::Transport::SMTP",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Mail%3A%3ATransport%3A%3ASMTP/json",
    "generated": "2026-06-12T23:29:59Z",
    "synopsis": "my $sender = Mail::Transport::SMTP->new(...);\n$sender->send($message);\n$message->send(via => 'smtp');",
    "sections": {
        "NAME": {
            "content": "Mail::Transport::SMTP - transmit messages without external program\n",
            "subsections": []
        },
        "INHERITANCE": {
            "content": "Mail::Transport::SMTP\nis a Mail::Transport::Send\nis a Mail::Transport\nis a Mail::Reporter\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "my $sender = Mail::Transport::SMTP->new(...);\n$sender->send($message);\n\n$message->send(via => 'smtp');\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module implements transport of \"Mail::Message\" objects by negotiating to the destination\nhost directly by using the SMTP protocol, without help of \"sendmail\", \"mail\", or other programs\non the local host.\n\nwarning: you may need to install Net::SMTPS, to get TLS support.\n\nExtends \"DESCRIPTION\" in Mail::Transport::Send.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "Extends \"METHODS\" in Mail::Transport::Send.\n",
            "subsections": [
                {
                    "name": "Constructors",
                    "content": "Extends \"Constructors\" in Mail::Transport::Send.\n\nMail::Transport::SMTP->new(%options)\n-Option       --Defined in     --Default\nesmtpoptions                   {}\nexecutable     Mail::Transport  undef\nfrom                            undef\nhelo                            <from Net::Config>\nhostname       Mail::Transport  <from Net::Config>\ninterval       Mail::Transport  30\nlog            Mail::Reporter   'WARNINGS'\npassword                        undef\nport           Mail::Transport  25\nproxy          Mail::Transport  <from Net::Config>\nretry          Mail::Transport  <false>\nsmtpdebug                      <false>\ntimeout                         120\ntrace          Mail::Reporter   'WARNINGS'\nusername                        undef\nvia            Mail::Transport  'smtp'\n\nesmtpoptions => HASH\n[2.116] ESMTP options to pass to Net::SMTP. See the Net::SMTP documentation for full\ndetails. Options can also be passed at send time. For example: \"{ XVERP => 1 }\"\n\nexecutable => FILENAME\nfrom => ADDRESS\nAllows a default sender address to be specified globally. See trySend() for full details.\n\nhelo => HOST\nThe fully qualified name of the sender's host (your system) which is used for the greeting\nmessage to the receiver. If not specified, Net::Config or else Net::Domain are questioned\nto find it. When even these do not supply a valid name, the name of the domain in the\n\"From\" line of the message is assumed.\n\nhostname => HOSTNAME|ARRAY\ninterval => SECONDS\nlog => LEVEL\npassword => STRING\nThe password to be used with the new(username) to log in to the remote server.\n\nport => INTEGER\nproxy => PATH\nretry => NUMBER|undef\nsmtpdebug => BOOLEAN\nSimulate transmission: the SMTP protocol output will be sent to your screen.\n\ntimeout => SECONDS\nThe number of seconds to wait for a valid response from the server before failing.\n\ntrace => LEVEL\nusername => STRING\nUse SASL authentication to contact the remote SMTP server (RFC2554). This username in\ncombination with new(password) is passed as arguments to Net::SMTP method auth. Other\nforms of authentication are not supported by Net::SMTP. The \"username\" can also be\nspecified as an Authen::SASL object.\n\nvia => CLASS|NAME\n"
                },
                {
                    "name": "Sending mail",
                    "content": "Extends \"Sending mail\" in Mail::Transport::Send.\n\n$obj->destinations( $message, [$address|ARRAY] )\nInherited, see \"Sending mail\" in Mail::Transport::Send\n\n$obj->putContent($message, $fh, %options)\nInherited, see \"Sending mail\" in Mail::Transport::Send\n\n$obj->send($message, %options)\nInherited, see \"Sending mail\" in Mail::Transport::Send\n\n$obj->trySend($message, %options)\nTry to send the $message once. This may fail, in which case this method will return \"false\".\nIn list context, the reason for failure can be caught: in list context \"trySend\" will return\na list of six values:\n\n(success, rc, rc-text, error location, quit success, accept)\n\nSuccess and quit success are booleans. The error code and -text are protocol specific codes\nand texts. The location tells where the problem occurred.\n\n[3.003] the 'accept' returns the message of the dataend() instruction. Some servers may\nprovide useful information in there, like an internal message registration id. For example,\npostfix may return \"2.0.0 Ok: queued as 303EA380EE\". You can only use this parameter when\nrunning local delivery (which is a smart choice anyway)\n\n-Option       --Default\nesmtpoptions  {}\nfrom           < >\nto             []\n\nesmtpoptions => HASH\nAdditional or overridden EMSTP options. See new(esmtpoptions)\n\nfrom => ADDRESS\nYour own identification. This may be fake. If not specified, it is taken from\nMail::Message::sender(), which means the content of the \"Sender\" field of the message or\nthe first address of the \"From\" field. This defaults to \"< >\", which represents \"no\naddress\".\n\nto => ADDRESS|[ADDRESSES]\nAlternative destinations. If not specified, the \"To\", \"Cc\" and \"Bcc\" fields of the header\nare used. An address is a string or a Mail::Address object.\n"
                },
                {
                    "name": "Server connection",
                    "content": "Extends \"Server connection\" in Mail::Transport::Send.\n\n$obj->contactAnyServer()\nCreates the connection to the SMTP server. When more than one hostname was specified, the\nfirst which accepts a connection is taken. An IO::Socket::INET object is returned.\n\n$obj->findBinary( $name, [@directories] )\nInherited, see \"Server connection\" in Mail::Transport\n\n$obj->remoteHost()\nInherited, see \"Server connection\" in Mail::Transport\n\n$obj->retry()\nInherited, see \"Server connection\" in Mail::Transport\n\n$obj->tryConnectTo($host, %options)\nTry to establish a connection to deliver SMTP to the specified $host. The %options are\npassed to the \"new\" method of Net::SMTP.\n"
                },
                {
                    "name": "Error handling",
                    "content": "Extends \"Error handling\" in Mail::Transport::Send.\n\n$obj->AUTOLOAD()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->addReport($object)\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $callback] )\nMail::Transport::SMTP->defaultTrace( [$level]|[$loglevel, $tracelevel]|[$level, $callback] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->errors()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->log( [$level, [$strings]] )\nMail::Transport::SMTP->log( [$level, [$strings]] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->logPriority($level)\nMail::Transport::SMTP->logPriority($level)\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->logSettings()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->notImplemented()\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->report( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->reportAll( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->trace( [$level] )\nInherited, see \"Error handling\" in Mail::Reporter\n\n$obj->warnings()\nInherited, see \"Error handling\" in Mail::Reporter\n"
                },
                {
                    "name": "Cleanup",
                    "content": "Extends \"Cleanup\" in Mail::Transport::Send.\n\n$obj->DESTROY()\nInherited, see \"Cleanup\" in Mail::Reporter\n"
                }
            ]
        },
        "DIAGNOSTICS": {
            "content": "Warning: Message has no destination\nIt was not possible to figure-out where the message is intended to go to.\n\nNotice: No addresses found to send the message to, no connection made\nError: Package $package does not implement $method.\nFatal error: the specific package (or one of its superclasses) does not implement this\nmethod where it should. This message means that some other related classes do implement this\nmethod however the class at hand does not. Probably you should investigate this and probably\ninform the author of the package.\n\nWarning: Resent group does not specify a destination\nThe message which is sent is the result of a bounce (for instance created with\nMail::Message::bounce()), and therefore starts with a \"Received\" header field. With the\n\"bounce\", the new destination(s) of the message are given, which should be included as\n\"Resent-To\", \"Resent-Cc\", and \"Resent-Bcc\".\n\nThe \"To\", \"Cc\", and \"Bcc\" header information is only used if no \"Received\" was found. That\nseems to be the best explanation of the RFC.\n\nAs alternative, you may also specify the \"to\" option to some of the senders (for instance\nMail::Transport::SMTP::send(to) to overrule any information found in the message itself\nabout the destination.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "This module is part of Mail-Transport distribution version 3.005, built on July 22, 2020.\nWebsite: http://perl.overmeer.net/CPAN/\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "Copyrights 2001-2020 by [Mark Overmeer]. For other contributors see ChangeLog.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself. See http://dev.perl.org/licenses/\n",
            "subsections": []
        }
    },
    "summary": "Mail::Transport::SMTP - transmit messages without external program",
    "flags": [],
    "examples": [],
    "see_also": []
}