{
    "mode": "perldoc",
    "parameter": "Mail::Send",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Mail%3A%3ASend/json",
    "generated": "2026-06-14T00:19:13Z",
    "synopsis": "require Mail::Send;\n$msg = Mail::Send->new;\n$msg = Mail::Send->new(Subject => 'example', To => 'timbo');\n$msg->to('user@host');\n$msg->to('user@host', 'user2@example.com');\n$msg->subject('example subject');\n$msg->cc('user@host');\n$msg->bcc('someone@else');\n$msg->set($header, @values);\n$msg->add($header, @values);\n$msg->delete($header);\n# Launch mailer and set headers. The filehandle returned\n# by open() is an instance of the Mail::Mailer class.\n# Arguments to the open() method are passed to the Mail::Mailer\n# constructor.\n$fh = $msg->open;   # some default mailer\n$fh = $msg->open('sendmail'); # explicit\nprint $fh \"Body of message\";\n$fh->close          # complete the message and send it\nor die \"couldn't send whole message: $!\\n\";",
    "sections": {
        "NAME": {
            "content": "Mail::Send - Simple electronic mail interface\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "require Mail::Send;\n\n$msg = Mail::Send->new;\n$msg = Mail::Send->new(Subject => 'example', To => 'timbo');\n\n$msg->to('user@host');\n$msg->to('user@host', 'user2@example.com');\n$msg->subject('example subject');\n$msg->cc('user@host');\n$msg->bcc('someone@else');\n\n$msg->set($header, @values);\n$msg->add($header, @values);\n$msg->delete($header);\n\n# Launch mailer and set headers. The filehandle returned\n# by open() is an instance of the Mail::Mailer class.\n# Arguments to the open() method are passed to the Mail::Mailer\n# constructor.\n\n$fh = $msg->open;   # some default mailer\n$fh = $msg->open('sendmail'); # explicit\nprint $fh \"Body of message\";\n$fh->close          # complete the message and send it\nor die \"couldn't send whole message: $!\\n\";\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Mail::Send creates e-mail messages without using the Mail::Header knowledge, which means that\nall escaping and folding must be done by you! Also: do not forget to escape leading dots.\nSimplicity has its price.\n\nWhen you have time, take a look at Mail::Transport which is part of the MailBox suite.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "",
            "subsections": [
                {
                    "name": "Constructors",
                    "content": "Mail::Send->new(PAIRS)\nA list of header fields (provided as key-value PAIRS) can be used to initialize the object,\nlimited to the few provided as method: \"to\", \"subject\", \"cc\", and \"bcc\". For other header\nfields, use add().\n"
                },
                {
                    "name": "Header fields",
                    "content": "$obj->add($fieldname, @values)\nAdd values to the list of defined values for the $fieldname.\n\n$obj->bcc(@values)\n$obj->cc(@values)\n$obj->delete($fieldname)\n$obj->set($fieldname, @values)\nThe @values will replace the old values for the $fieldname. Returned is the LIST of values\nafter modification.\n\n$obj->subject(@values)\n$obj->to(@values)\n"
                },
                {
                    "name": "Sending",
                    "content": "$obj->open(%options)\nThe %options are used to initiate a mailer object via Mail::Mailer::new(). Then\nMail::Mailer::open() is called with the knowledge collected in this \"Mail::Send\" object.\n\nBe warned: this module implements raw smtp, which means that you have to escape lines which\nstart with a dot, by adding one in front.\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "This module is part of the MailTools distribution, http://perl.overmeer.net/mailtools/.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "The MailTools bundle was developed by Graham Barr. Later, Mark Overmeer took over maintenance\nwithout commitment to further development.\n\nMail::Cap by Gisle Aas <aas@oslonett.no>. Mail::Field::AddrList by Peter Orbaek <poe@cit.dk>.\nMail::Mailer and Mail::Send by Tim Bunce <Tim.Bunce@ig.co.uk>. For other contributors see\nChangeLog.\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "Copyrights 1995-2000 Graham Barr <gbarr@pobox.com> and 2001-2017 Mark Overmeer\n<perl@overmeer.net>.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself. See http://www.perl.com/perl/misc/Artistic.html\n",
            "subsections": []
        }
    },
    "summary": "Mail::Send - Simple electronic mail interface",
    "flags": [],
    "examples": [],
    "see_also": []
}