{
    "content": [
        {
            "type": "text",
            "text": "# Mail::Sender (perldoc)\n\n## NAME\n\nMail::Sender - module for sending mails with attachments through an SMTP server  Version 0.8.16\n\n## SYNOPSIS\n\nuse Mail::Sender;\n$sender = new Mail::Sender\n{smtp => 'mail.yourdomain.com', from => 'your@address.com'};\n$sender->MailFile({to => 'some@address.com',\nsubject => 'Here is the file',\nmsg => \"I'm sending you the list you wanted.\",\nfile => 'filename.txt'});\n\n## DESCRIPTION\n\n\"Mail::Sender\" provides an object oriented interface to sending mails. It doesn't need any outer\nprogram. It connects to a mail server directly from Perl, using Socket.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (2 subsections)\n- **METHODS** (19 subsections)\n- **FUNCTIONS** (2 subsections)\n- **CONFIG**\n- **AUTHENTICATION** (1 subsections)\n- **EXAMPLES** (12 subsections)\n- **BUGS**\n- **SEE ALSO**\n- **DISCLAIMER**\n- **AUTHOR**\n- **COPYRIGHT**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Mail::Sender",
        "section": "",
        "mode": "perldoc",
        "summary": "Mail::Sender - module for sending mails with attachments through an SMTP server  Version 0.8.16",
        "synopsis": "use Mail::Sender;\n$sender = new Mail::Sender\n{smtp => 'mail.yourdomain.com', from => 'your@address.com'};\n$sender->MailFile({to => 'some@address.com',\nsubject => 'Here is the file',\nmsg => \"I'm sending you the list you wanted.\",\nfile => 'filename.txt'});",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [
            "ref ($sender = new Mail::Sender { from => 'somebody@somewhere.com',",
            "smtp => 'mail.yourISP.com', boundary => 'This-is-a-mail-boundary-435427'})",
            "or die \"Error in mailing : $Mail::Sender::Error\\n\";",
            "or",
            "my $sender = new Mail::Sender { ... };",
            "die \"Error in mailing : $Mail::Sender::Error\\n\" unless ref $sender;",
            "or",
            "my $sender = new Mail::Sender { ..., onerrors => 'undef' }",
            "or die \"Error in mailing : $Mail::Sender::Error\\n\";",
            "You may specify the options either when creating the Mail::Sender object or later when you open",
            "a message. You may also set the default options when installing the module (See \"CONFIG\"",
            "section). This way the admin may set the SMTP server and even the authentication options and the",
            "users do not have to specify it again.",
            "You should keep in mind that the way Mail::Sender reports failures depends on the 'onerrors'=>",
            "option. If you set it to 'die' it throws an exception, if you set it to \"undef\" or 'undef' it",
            "returns undef and otherwise it returns a negative error code!",
            "$sender = new Mail::Sender {",
            "smtp => 'mail.yourISP.com',",
            "from => 'somebody@somewhere.com',",
            "onerrors => undef,",
            "or die \"Can't create the Mail::Sender object: $Mail::Sender::Error\\n\";",
            "$sender->Open({",
            "to => 'mama@home.org, papa@work.com',",
            "cc => 'somebody@somewhere.com',",
            "subject => 'Sorry, I\\'ll come later.'",
            "})",
            "or die \"Can't open the message: $sender->{'errormsg'}\\n\";",
            "$sender->SendLineEnc(\"I'm sorry, but thanks to the lusers,",
            "I'll come at 10pm at best.\");",
            "$sender->SendLineEnc(\"\\nHi, Jenda\");",
            "$sender->Close()",
            "or die \"Failed to send the message: $sender->{'errormsg'}\\n\";",
            "or",
            "eval {",
            "$sender = new Mail::Sender {",
            "smtp => 'mail.yourISP.com',",
            "from => 'somebody@somewhere.com',",
            "onerrors => 'die',",
            "};",
            "$sender->Open({",
            "to => 'mama@home.org, papa@work.com',",
            "cc => 'somebody@somewhere.com',",
            "subject => 'Sorry, I\\'ll come later.'",
            "});",
            "$sender->SendLineEnc(\"I'm sorry, but thanks to the lusers,",
            "I'll come at 10pm at best.\");",
            "$sender->SendLineEnc(\"\\nHi, Jenda\");",
            "$sender->Close();",
            "};",
            "if ($@) {",
            "die \"Failed to send the message: $@\\n\";",
            "or",
            "$sender = new Mail::Sender {",
            "smtp => 'mail.yourISP.com',",
            "from => 'somebody@somewhere.com',",
            "onerrors => 'code',",
            "};",
            "die \"Can't create the Mail::Sender object: $Mail::Sender::Error\\n\"",
            "unless ref $sender;",
            "ref $sender->Open({",
            "to => 'mama@home.org, papa@work.com',",
            "cc => 'somebody@somewhere.com',",
            "subject => 'Sorry, I\\'ll come later.'",
            "})",
            "or die \"Can't open the message: $sender->{'errormsg'}\\n\";",
            "$sender->SendLineEnc(\"I'm sorry, but thanks to the lusers,",
            "I'll come at 10pm at best.\");",
            "$sender->SendLineEnc(\"\\nHi, Jenda\");",
            "ref $sender->Close",
            "or die \"Failed to send the message: $sender->{'errormsg'}\\n\";",
            "Using GetHandle()",
            "ref $sender->Open({to => 'friend@other.com', subject => 'Hello dear friend'})",
            "or die \"Error: $Mail::Sender::Error\\n\";",
            "my $FH = $sender->GetHandle();",
            "print $FH \"How are you?\\n\\n\";",
            "print $FH <<'*END*';",
            "I've found these jokes.",
            "Doctor, I feel like a pack of cards.",
            "Sit down and I'll deal with you later.",
            "Doctor, I keep thinking I'm a dustbin.",
            "Don't talk rubbish.",
            "Hope you like'em. Jenda",
            "*END*",
            "$sender->Close;",
            "# or",
            "# close $FH;",
            "or",
            "eval {",
            "$sender->Open({ onerrors => 'die',",
            "to => 'mama@home.org, papa@work.com',",
            "cc => 'somebody@somewhere.com',",
            "subject => 'Sorry, I\\'ll come later.'});",
            "$sender->SendLineEnc(\"I'm sorry, but due to a big load of work,",
            "I'll come at 10pm at best.\");",
            "$sender->SendLineEnc(\"\\nHi, Jenda\");",
            "$sender->Close;",
            "};",
            "if ($@) {",
            "print \"Error sending the email: $@\\n\";",
            "} else {",
            "print \"The mail was sent.\\n\";",
            "$sender->OpenMultipart({to => 'Perl-Win32-Users@activeware.foo',",
            "subject => 'Mail::Sender.pm - new module'});",
            "$sender->Body;",
            "$sender->SendEnc(<<'*END*');",
            "Here is a new module Mail::Sender.",
            "It provides an object based interface to sending SMTP mails.",
            "It uses a direct socket connection, so it doesn't need any",
            "additional program.",
            "Enjoy, Jenda",
            "*END*",
            "$sender->Attach(",
            "{description => 'Perl module Mail::Sender.pm',",
            "ctype => 'application/x-zip-encoded',",
            "encoding => 'Base64',",
            "disposition => 'attachment; filename=\"Sender.zip\"; type=\"ZIP archive\"',",
            "file => 'sender.zip'",
            "});",
            "$sender->Close;",
            "or",
            "$sender->OpenMultipart({to => 'Perl-Win32-Users@activeware.foo',",
            "subject => 'Mail::Sender.pm - new version'});",
            "$sender->Body({ msg => <<'*END*' });",
            "Here is a new module Mail::Sender.",
            "It provides an object based interface to sending SMTP mails.",
            "It uses a direct socket connection, so it doesn't need any",
            "additional program.",
            "Enjoy, Jenda",
            "*END*",
            "$sender->Attach(",
            "{description => 'Perl module Mail::Sender.pm',",
            "ctype => 'application/x-zip-encoded',",
            "encoding => 'Base64',",
            "disposition => 'attachment; filename=\"Sender.zip\"; type=\"ZIP archive\"',",
            "file => 'sender.zip'",
            "});",
            "$sender->Close;",
            "or (in case you have the file contents in a scalar)",
            "$sender->OpenMultipart({to => 'Perl-Win32-Users@activeware.foo',",
            "subject => 'Mail::Sender.pm - new version'});",
            "$sender->Body({ msg => <<'*END*' });",
            "Here is a new module Mail::Sender.",
            "It provides an object based interface to sending SMTP mails.",
            "It uses a direct socket connection, so it doesn't need any",
            "additional program.",
            "Enjoy, Jenda",
            "*END*",
            "$sender->Part(",
            "{description => 'Perl module Mail::Sender.pm',",
            "ctype => 'application/x-zip-encoded',",
            "encoding => 'Base64',",
            "disposition => 'attachment; filename=\"Sender.zip\"; type=\"ZIP archive\"',",
            "msg => $senderzipcontents,",
            "});",
            "$sender->Close;",
            "Using exceptions (no need to test return values after each function)",
            "use Mail::Sender;",
            "eval {",
            "(new Mail::Sender {onerrors => 'die'})",
            "->OpenMultipart({smtp=> 'jenda.krynicky.cz', to => 'jenda@krynicky.cz',subject => 'Mail::Sender.pm - new version'})",
            "->Body({ msg => <<'*END*' })",
            "Here is a new module Mail::Sender.",
            "It provides an object based interface to sending SMTP mails.",
            "It uses a direct socket connection, so it doesn't need any",
            "additional program.",
            "Enjoy, Jenda",
            "*END*",
            "->Attach({",
            "description => 'Perl module Mail::Sender.pm',",
            "ctype => 'application/x-zip-encoded',",
            "encoding => 'Base64',",
            "disposition => 'attachment; filename=\"Sender.zip\"; type=\"ZIP archive\"',",
            "file => 'W:\\jenda\\packages\\Mail\\Sender\\Mail-Sender-0.7.14.3.tar.gz'",
            "})",
            "->Close();",
            "} or print \"Error sending mail: $@\\n\";",
            "Using MailMsg() shortcut to send simple messages",
            "If everything you need is to send a simple message you may use:",
            "if (ref ($sender->MailMsg({to =>'Jenda@Krynicky.czX', subject => 'this is a test',",
            "msg => \"Hi Johnie.\\nHow are you?\"}))) {",
            "print \"Mail sent OK.\"",
            "} else {",
            "die \"$Mail::Sender::Error\\n\";",
            "or",
            "if ($sender->MailMsg({",
            "smtp => 'mail.yourISP.com',",
            "from => 'somebody@somewhere.com',",
            "to =>'Jenda@Krynicky.czX',",
            "subject => 'this is a test',",
            "msg => \"Hi Johnie.\\nHow are you?\"",
            "}) < 0) {",
            "die \"$Mail::Sender::Error\\n\";",
            "print \"Mail sent OK.\"",
            "if ($sender->MailMsg({",
            "smtp => 'mail.yourISP.com',",
            "from => 'somebody@somewhere.com',",
            "to =>'Jenda@Krynicky.czX',",
            "subject => 'this is a test',",
            "msg => \"Hi Johnie.\\nHow are you?\"",
            "auth => 'NTLM',",
            "authid => 'jenda',",
            "authpwd => 'benda',",
            "}) < 0) {",
            "die \"$Mail::Sender::Error\\n\";",
            "print \"Mail sent OK.\"",
            "Using MailFile() shortcut to send an attachment",
            "If you want to attach some files:",
            "(ref ($sender->MailFile(",
            "{to =>'you@address.com', subject => 'this is a test',",
            "msg => \"Hi Johnie.\\nI'm sending you the pictures you wanted.\",",
            "file => 'image1.jpg,image2.jpg'",
            "}))",
            "and print \"Mail sent OK.\"",
            "or die \"$Mail::Sender::Error\\n\";",
            "If you are sure the HTML doesn't contain any accentuated characters (with codes above 127).",
            "open IN, $htmlfile or die \"Cannot open $htmlfile : $!\\n\";",
            "$sender->Open({ from => 'your@address.com', to => 'other@address.com',",
            "subject => 'HTML test',",
            "ctype => \"text/html\",",
            "encoding => \"7bit\"",
            "}) or die $Mail::Sender::Error,\"\\n\";",
            "while (<IN>) { $sender->SendEx($) };",
            "close IN;",
            "$sender->Close();",
            "Otherwise use SendEnc() instead of SendEx() and \"quoted-printable\" instead of \"7bit\".",
            "Another ... quicker way ... would be:",
            "open IN, $htmlfile or die \"Cannot open $htmlfile : $!\\n\";",
            "$sender->Open({ from => 'your@address.com', to => 'other@address.com',",
            "subject => 'HTML test',",
            "ctype => \"text/html\",",
            "encoding => \"quoted-printable\"",
            "}) or die $Mail::Sender::Error,\"\\n\";",
            "while (read IN, $buff, 4096) { $sender->SendEnc($buff) };",
            "close IN;",
            "$sender->Close();",
            "if (ref $sender->OpenMultipart({",
            "from => 'someone@somewhere.net', to => $recipients,",
            "subject => 'Embedded Image Test',",
            "boundary => 'boundary-test-1',",
            "multipart => 'related'})) {",
            "$sender->Attach(",
            "{description => 'html body',",
            "ctype => 'text/html; charset=us-ascii',",
            "encoding => '7bit',",
            "disposition => 'NONE',",
            "file => 'test.html'",
            "});",
            "$sender->Attach({",
            "description => 'ed\\'s gif',",
            "ctype => 'image/gif',",
            "encoding => 'base64',",
            "disposition => \"inline; filename=\\\"apachepb.gif\\\";\\r\\nContent-ID: <img1>\",",
            "file => 'apachepb.gif'",
            "});",
            "$sender->Close() or die \"Close failed! $Mail::Sender::Error\\n\";",
            "} else {",
            "die \"Cannot send mail: $Mail::Sender::Error\\n\";",
            "And in the HTML you'll have this : ... <IMG src=\"cid:img1\"> ... on the place where you want the",
            "inlined image.",
            "Please keep in mind that the image name is unimportant, it's the Content-ID what counts!",
            "# or using the eval{ $obj->Method()->Method()->...->Close()} trick ...",
            "use Mail::Sender;",
            "eval {",
            "(new Mail::Sender)",
            "->OpenMultipart({",
            "to => 'someone@somewhere.com',",
            "subject => 'Embedded Image Test',",
            "boundary => 'boundary-test-1',",
            "type => 'multipart/related'",
            "})",
            "->Attach({",
            "description => 'html body',",
            "ctype => 'text/html; charset=us-ascii',",
            "encoding => '7bit',",
            "disposition => 'NONE',",
            "file => 'c:\\temp\\zk\\HTMLTest.htm'",
            "})",
            "->Attach({",
            "description => 'Test gif',",
            "ctype => 'image/gif',",
            "encoding => 'base64',",
            "disposition => \"inline; filename=\\\"test.gif\\\";\\r\\nContent-ID: <img1>\",",
            "file => 'test.gif'",
            "})",
            "->Close()",
            "or die \"Cannot send mail: $Mail::Sender::Error\\n\";",
            "use Mail::Sender;",
            "eval {",
            "(new Mail::Sender)",
            "->OpenMultipart({",
            "to => 'someone@somewhere.com',",
            "subject => 'Alternatives',",
            "#               debug => 'c:\\temp\\zkMailFlow.log',",
            "multipart => 'mixed',",
            "})",
            "->Part({ctype => 'multipart/alternative'})",
            "->Part({ ctype => 'text/plain', disposition => 'NONE', msg => <<'*END*' })",
            "A long",
            "mail",
            "message.",
            "*END*",
            "->Part({ctype => 'text/html', disposition => 'NONE', msg => <<'*END*'})",
            "<html><body><h1>A long</h1><p align=center>",
            "mail",
            "message.",
            "</p></body></html>",
            "*END*",
            "->EndPart(\"multipart/alternative\")",
            "->Close();",
            "} or print \"Error sending mail: $Mail::Sender::Error\\n\";",
            "use Mail::Sender;",
            "eval {",
            "(new Mail::Sender)",
            "->OpenMultipart({",
            "to => 'someone@somewhere.com',",
            "subject => 'Alternatives with images',",
            "#               debug => 'c:\\temp\\zkMailFlow.log',",
            "multipart => 'related',",
            "})",
            "->Part({ctype => 'multipart/alternative'})",
            "->Part({ ctype => 'text/plain', disposition => 'NONE', msg => <<'*END*' })",
            "A long",
            "mail",
            "message.",
            "*END*",
            "->Part({ctype => 'text/html', disposition => 'NONE', msg => <<'*END*'})",
            "<html><body><h1>A long</h1><p align=center>",
            "mail",
            "message.",
            "<img src=\"cid:img1\">",
            "</p></body></html>",
            "*END*",
            "->EndPart(\"multipart/alternative\")",
            "->Attach({",
            "description => 'ed\\'s jpg',",
            "ctype => 'image/jpeg',",
            "encoding => 'base64',",
            "disposition => \"inline; filename=\\\"0518mb.jpg\\\";\\r\\nContent-ID: <img1>\",",
            "file => 'E:\\pix\\humor\\0518mb.jpg'",
            "})",
            "->Close();",
            "} or print \"Error sending mail: $Mail::Sender::Error\\n\";",
            "Keep in mind please that different mail clients display messages differently. You may need to",
            "try several ways to create messages so that they appear the way you need. These two examples",
            "looked like I expected in Pegasus Email and MS Outlook.",
            "If this doesn't work with your mail client, please let me know and we might find a way.",
            "use CGI;",
            "use Mail::Sender;",
            "$query = new CGI;",
            "# uploading the file...",
            "$filename = $query->param('mailformFile');",
            "if ($filename ne \"\"){",
            "$tmpfile = $query->tmpFileName($filename);",
            "$sender = new Mail::Sender {from => 'script@krynicky.cz',smtp => 'mail.krynicky.czX'};",
            "$sender->OpenMultipart({to=> 'jenda@krynicky.czX',subject=> 'test CGI attach'});",
            "$sender->Body();",
            "$sender->Send(<<\"*END*\");",
            "This is just a test of mail with an uploaded file.",
            "Jenda",
            "*END*",
            "$sender->Attach({",
            "encoding => 'Base64',",
            "description => $filename,",
            "ctype => $query->uploadInfo($filename)->{'Content-Type'},",
            "disposition => \"attachment; filename = $filename\",",
            "file => $tmpfile",
            "});",
            "$sender->Close();",
            "print \"Content-type: text/plain\\n\\nYes, it's sent\\n\\n\";",
            "use Mail::Sender;",
            "my $sender = new Mail::Sender {smtp => 'localhost'};",
            "die \"Error: $Mail::Sender::Error\\n\" unless ref $sender;",
            "print join(', ', $sender->QueryAuthProtocols()),\"\\n\";",
            "or (if you have Mail::Sender 0.8.05 or newer)",
            "use Mail::Sender;",
            "print join(', ', Mail::Sender->QueryAuthProtocols('localhost')),\"\\n\";",
            "or",
            "use Mail::Sender;",
            "print join(', ', Mail::Sender::QueryAuthProtocols('localhost')),\"\\n\";",
            "FAQ",
            "Forwarding the messages created by Mail::Sender removes accents. Why?",
            "The most likely colprit is missing or incorrect charset specified for the body or a part of the",
            "email. You should add something like",
            "charset => 'iso-8859-1',",
            "encoding => 'quoted-printable',",
            "to the parameters passed to Open(), OpenMultipart(), MailMsg(), Body() or Part() or",
            "bcharset => 'iso-8859-1',",
            "bencoding => 'quoted-printable',",
            "to the parameters for MailFile().",
            "If you use a different charset ('iso-8859-2', 'win-1250', ...) you will of course need to",
            "specify that charset. If you are not sure, try to send a mail with some other mail client and",
            "then look at the message/part headers.",
            "I open the email in Outlook. What's wrong?",
            "Outlook is. It has (had) a bug in its quoted printable decoding routines. This problem happens",
            "only in quoted-printable encoded parts on multipart messages. And only if the data in that part",
            "do not end with a newline. (This is new in 0.8.08, in older versions it happened in all QP",
            "encoded parts.)",
            "The problem is that an equals sign at the end of a line in a quoted printable encoded text means",
            "\"ignore the newline\". That is",
            "fooo sdfg sdfg sdfh dfh =",
            "dfsgdsfg",
            "should be decoded as",
            "fooo sdfg sdfg sdfh dfh dfsgdsfg",
            "The problem is at the very end of a file. The part boundary (text separating different parts of",
            "a multipart message) has to start on a new line, if the attached file ends by a newline",
            "everything is cool. If it doesn't I need to add a newline and to denote that the newline is not",
            "part of the original file I add an equals:",
            "dfgd dsfgh dfh dfh dfhdfhdfhdfgh",
            "this is the last line.=",
            "--message-boundary-146464--",
            "Otherwise I'd add a newline at the end of the file. If you do not care about the newline and",
            "want to be sure Outlook doesn't add the equals to the file add",
            "bypassoutlookbug => 1",
            "parameter to \"new Mail::Sender\" or \"Open\"/\"OpenMultipart\".",
            "WARNING",
            "DO NOT mix Open(Multipart)|Send(Line)(Ex)|Close with MailMsg or MailFile. Both Mail(Msg/File)",
            "close any Open-ed mail. Do not try this:",
            "$sender = new Mail::Sender ...;",
            "$sender->OpenMultipart...;",
            "$sender->Body;",
            "$sender->Send(\"...\");",
            "$sender->MailFile({file => 'something.ext');",
            "$sender->Close;",
            "This WON'T work!!!",
            "GOTCHAS",
            "Local user \"someone@somewhere.com\" doesn't exist",
            "\"Thanks\" to spammers mail servers usualy do not allow just anyone to post a message through",
            "them. Most often they require that either the sender or the recipient is local to the server",
            "Mail::Sendmail works, Mail::Sender doesn't",
            "If you are able to connect to the mail server and scripts using Mail::Sendmail work, but",
            "Mail::Sender fails with \"connect() failed\", please review the settings in /etc/services. The",
            "port for SMTP should be 25.",
            "$/ and $\\",
            "If you change the $/ ($RS, $INPUTRECORDSEPARATOR) or $\\ ($ORS, $OUTPUTRECORDSEPARATOR) or $,",
            "($OFS, $OUTPUTFIELDSEPARATOR) Mail::Sender may stop working! Keep in mind that those variables",
            "are global and therefore they change the behaviour of <> and print everywhere. And since the",
            "SMTP is a plain text protocol if you change the notion of lines you can break it.",
            "If you have to fiddle with $/, $\\ or $, do it in the smallest possible block of code and",
            "open my $IN, '<', $filename or die \"Can't open $filename: $!\\n\";",
            "my $data = do {local $/; <$IN>};",
            "close $IN;"
        ],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 16,
                "subsections": [
                    {
                        "name": "Parameters",
                        "lines": 249
                    },
                    {
                        "name": "Return codes",
                        "lines": 24
                    }
                ]
            },
            {
                "name": "METHODS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Open",
                        "lines": 18
                    },
                    {
                        "name": "OpenMultipart",
                        "lines": 10
                    },
                    {
                        "name": "MailMsg",
                        "lines": 19
                    },
                    {
                        "name": "MailFile",
                        "lines": 19
                    },
                    {
                        "name": "Send",
                        "lines": 9
                    },
                    {
                        "name": "SendLine",
                        "lines": 23
                    },
                    {
                        "name": "SendEnc",
                        "lines": 8
                    },
                    {
                        "name": "SendLineEnc",
                        "lines": 14
                    },
                    {
                        "name": "SendEx",
                        "lines": 9
                    },
                    {
                        "name": "SendLineEx",
                        "lines": 9
                    },
                    {
                        "name": "Part",
                        "lines": 52
                    },
                    {
                        "name": "Body",
                        "lines": 14
                    },
                    {
                        "name": "SendFile",
                        "lines": 2
                    },
                    {
                        "name": "Attach",
                        "lines": 46
                    },
                    {
                        "name": "EndPart",
                        "lines": 9
                    },
                    {
                        "name": "Close",
                        "lines": 16
                    },
                    {
                        "name": "Cancel",
                        "lines": 9
                    },
                    {
                        "name": "QueryAuthProtocols",
                        "lines": 7
                    },
                    {
                        "name": "GetHandle",
                        "lines": 16
                    }
                ]
            },
            {
                "name": "FUNCTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "GuessCType",
                        "lines": 21
                    },
                    {
                        "name": "ResetGMTdiff",
                        "lines": 6
                    }
                ]
            },
            {
                "name": "CONFIG",
                "lines": 84,
                "subsections": []
            },
            {
                "name": "AUTHENTICATION",
                "lines": 19,
                "subsections": [
                    {
                        "name": "Other protocols",
                        "lines": 27
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Object creation",
                        "lines": 23
                    },
                    {
                        "name": "Simple single part message",
                        "lines": 100
                    },
                    {
                        "name": "Multipart message with attachment",
                        "lines": 108
                    },
                    {
                        "name": "Using MailMsg and authentication",
                        "lines": 26
                    },
                    {
                        "name": "Sending HTML messages",
                        "lines": 28
                    },
                    {
                        "name": "Sending HTML messages with inline images",
                        "lines": 58
                    },
                    {
                        "name": "Sending message with plaintext and HTML alternatives",
                        "lines": 26
                    },
                    {
                        "name": "Sending message with plaintext and HTML alternatives with inline images",
                        "lines": 40
                    },
                    {
                        "name": "Sending a file that was just uploaded from an HTML form",
                        "lines": 30
                    },
                    {
                        "name": "Listing the authentication protocols supported by the server",
                        "lines": 34
                    },
                    {
                        "name": "Sometimes there is an equals sign at the end of an attached file when",
                        "lines": 62
                    },
                    {
                        "name": "local",
                        "lines": 4
                    }
                ]
            },
            {
                "name": "BUGS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "DISCLAIMER",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Mail::Sender - module for sending mails with attachments through an SMTP server\n\nVersion 0.8.16\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Mail::Sender;\n$sender = new Mail::Sender\n{smtp => 'mail.yourdomain.com', from => 'your@address.com'};\n$sender->MailFile({to => 'some@address.com',\nsubject => 'Here is the file',\nmsg => \"I'm sending you the list you wanted.\",\nfile => 'filename.txt'});\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "\"Mail::Sender\" provides an object oriented interface to sending mails. It doesn't need any outer\nprogram. It connects to a mail server directly from Perl, using Socket.\n\nSends mails directly from Perl through a socket connection.\n\nnew Mail::Sender\nnew Mail::Sender ([from [,replyto [,to [,smtp [,subject [,headers [,boundary]]]]]]])\nnew Mail::Sender {[from => 'somebody@somewhere.com'] , [to => 'else@nowhere.com'] [...]}\n\nPrepares a sender. This doesn't start any connection to the server. You have to use\n\"$Sender-\"Open> or \"$Sender-\"OpenMultipart> to start talking to the server.\n\nThe parameters are used in subsequent calls to \"$Sender-\"Open> and \"$Sender-\"OpenMultipart>.\nEach such call changes the saved variables. You can set \"smtp\", \"from\" and other options here\nand then use the info in all messages.\n",
                "subsections": [
                    {
                        "name": "Parameters",
                        "content": "from\n\"\"=> the sender's e-mail address\n\nfakefrom\n\"\"=> the address that will be shown in headers.\n\nIf not specified we use the value of \"from\".\n\nreplyto\n\"\"=> the reply-to address\n\nto  \"\"=> the recipient's address(es)\n\nThis parameter may be either a comma separated list of email addresses or a reference to a\nlist of addresses.\n\nfaketo\n\"\"=> the recipient's address that will be shown in headers. If not specified we use the\nvalue of \"to\".\n\nIf the list of addresses you want to send your message to is long or if you do not want the\nrecipients to see each other's address set the \"faketo\" parameter to some informative, yet\nbogus, address or to the address of your mailing/distribution list.\n\ncc  \"\"=> address(es) to send a copy (CC:) to\n\nfakecc\n\"\"=> the address that will be shown in headers.\n\nIf not specified we use the value of \"cc\".\n\nbcc \"\"=> address(es) to send a copy (BCC: or blind carbon copy). these addresses will not be\nvisible in the mail!\n\nsmtp\n\"\"=> the IP or domain address of your SMTP (mail) server\n\nThis is the name of your LOCAL mail server, do NOT try to contact directly the adressee's\nmailserver! That would be slow and buggy, your script should only pass the messages to the\nnearest mail server and leave the rest to it. Keep in mind that the recipient's server may\nbe down temporarily.\n\nport\n\"\"=> the TCP/IP port used form the connection. By default getservbyname('smtp', 'tcp')||25.\nYou should only need to use this option if your mail server waits on a nonstandard port.\n\nsubject\n\"\"=> the subject of the message\n\nheaders\n\"\"=> the additional headers\n\nYou may use this parameter to add custon headers into the message. The parameter may be\neither a string containing the headers in the right format or a hash containing the headers\nand their values.\n\nboundary\n\"\"=> the message boundary\n\nYou usualy do not have to change this, it might only come in handy if you need to attach a\nmultipart mail created by Mail::Sender to your message as a single part. Even in that case\nany problems are unlikely.\n\nmultipart\n\"\"=> the MIME subtype for the whole message (Mixed/Related/Alternative)\n\nYou may need to change this setting if you want to send a HTML body with some inline images,\nor if you want to post the message in plain text as well as HTML (alternative). See the\nexamples at the end of the docs. You may also use the nickname \"subtype\".\n\nPlease keep in mind though that it's not currently possible to create nested parts with\nMail::Sender. If you need that level of control you should try MIME::Lite.\n\nctype\n\"\"=> the content type of a single part message\n\nPlease do not confuse these two. The 'multipart' parameter is used to specify the overall\ncontent type of a multipart message (for example a HTML document with inlined images) while\nctype is an ordinary content type for a single part message. For example a HTML mail message\nwithout any inlines.\n\nencoding\n\"\"=> encoding of a single part message or the body of a multipart message.\n\nIf the text of the message contains some extended characters or very long lines you should\nuse 'encoding => \"Quoted-printable\"' in the call to Open(), OpenMultipart(), MailMsg() or\nMailFile().\n\nKeep in mind that if you use some encoding you should either use SendEnc() or encode the\ndata yourself !\n\ncharset\n\"\"=> the charset of the message\n\nclient\n\"\"=> the name of the client computer.\n\nDuring the connection you send the mailserver your computer's name. By default Mail::Sender\nsends \"(gethostbyname 'localhost')[0]\". If that is not the address you need, you can specify\na different one.\n\npriority\n\"\"=> the message priority number\n\n1 = highest, 2 = high, 3 = normal, 4 = low, 5 = lowest\n\nconfirm\n\"\"=> whether you request reading or delivery confirmations and to what addresses:\n\n\"delivery\" - only delivery, to the C<from> address\n\"reading\" - only reading, to the C<from> address\n\"delivery, reading\" - both confirmations, to the C<from> address\n\"delivery: my.other@address.com\" - only delivery, to my.other@address.com\n...\n\nKeep in mind though that neither of those is guaranteed to work. Some servers/mail clients\ndo not support this feature and some users/admins may have disabled it. So it's possible\nthat your mail was delivered and read, but you wount get any confirmation!\n\nESMPT\nESMTP => {\nNOTIFY => 'SUCCESS,FAILURE,DELAY',\nRET => 'HDRS',\nORCPT => 'rfc822;my.other@address.com',\nENVID => 'iuhsdfobwoe8t237',\n}\n\nThis option contains data for SMTP extensions, for example it allows you to request delivery\nstatus notifications according to RFC1891.\n\nNOTIFY - to specify the conditions under which a delivery status notification should be\ngenerated. Should be either \"NEVER\" or a comma separated list of \"SUCCESS\", \"FAILURE\" and\n\"DELAY\".\n\nORCPT - used to convey the \"original\" (sender-specified) recipient address\n\nRET - to request that Delivery Status Notifications containing an indication of delivery\nfailure either return the entire contents of a message or only the message headers. Must be\neither FULL or HDRS\n\nENVID - used to propagate an identifier for this message transmission envelope, which is\nalso known to the sender and will, if present, be returned in any Delivery Status\nNotifications issued for this transmission\n\nYou do not need to worry about encoding the ORCPT or ENVID parameters.\n\nIf the SMTP server you connect to doesn't support this extension, the options will be\nignored.\n\ndebug\n\"\"=> \"/path/to/debug/file.txt\"\n\nor\n\n\"\"=> \\*FILEHANDLE\n\nor\n\n\"\"=> $FH\n\nAll the conversation with the server will be logged to that file or handle. All lines in the\nfile should end with CRLF (the Windows and Internet format). If even a single one of them\ndoes not, please let me know!\n\nIf you pass the path to the log file, Mail::Sender will overwrite it. If you want to append\nto the file, you have to open it yourself and pass the filehandle:\n\nopen my $DEBUG, \">> /path/to/debug/file.txt\"\nor die \"Can't open the debug file: $!\\n\"\n$sender = new Mail::Sender ({\n...\ndebug => $DEBUG,\n});\n\ndebuglevel\nOnly taken into account if the \"debug\" option is specified.\n\n1 - only log the conversation with the server, skip all message data\n2 - log the conversation and message headers\n3 - log the conversation and the message and part headers\n4 - log everything (default)\n\nauth\nthe SMTP authentication protocol to use to login to the server currently the only ones\nsupported are LOGIN, PLAIN, CRAM-MD5 and NTLM.\n\nSome protocols have module dependencies. CRAM-MD5 depends on Digest::HMACMD5 and NTLM on\nAuthen::NTLM.\n\nYou may add support for other authentication protocols yourself. See below.\n\nauthid\nthe username used to login to the server\n\nauthpwd\nthe password used to login to the server\n\nauthdomain\nthe domain name. Used optionaly by the NTLM authentication.\n\nOther authentication protocols may use other options as well. They should all start with\n\"auth\" though.\n\nPlease see the authentication section bellow.\n\nauthencoded\nIf set to a true value the LOGIN authentication assumes the authid and authpwd is already\nbase64 encoded.\n\nkeepconnection\nIf set to a true value causes the Mail::Sender to keep the connection open for several\nmessages. The connection will be closed if you call the Close() method with a true value or\nif you call Open, OpenMultipart, MailMsg or MailFile with the \"smtp\" parameter. This means\nthat if you want the object to keep the connection you should pass the \"smtp\" either to \"new\nMail::Sender\" or only to the first Open, OpenMultipart, MailMsg or MailFile!\n\nskipbadrecipients\nIf this option is set to false or not specified then Mail::Sender stops trying to send a\nmessage as soon as the first recipient's address fails. If it is set to a true value\nMail::Sender skips the bad addresses and tries to send the message at least to the good\nones. If all addresses are rejected by the server it reports an \"All recipients were\nrejected\" message.\n\nIf any addresses were skipped the \"$sender->{'skippedrecipients'}\" will be a reference to a\nhash containing the failed address and the server's response.\n\ncreatemessageid\nThis option allows you to overwrite the function that generates the message IDs for the\nemails. The function gets the \"pure\" sender's address as it's only parameter and is supposed\nto return a string. See the MessageID subroutine in Mail::Sender.pm.\n\nIf you want to specify a message id you can also use the \"messageid\" parameter for the Open,\nOpenMultipart, MailMsg or MailFile methods.\n\nonerrors\nThis option allows you to affect the way Mail::Sender reports errors.\n\n=> 'die' - raise an exception\n=> 'code' - return the negative error code (default)\n=> 'undef' - return an undef\n\n$Mail::Sender::Error, $sender->{'error'} and $sender->{'errormsg'} are set in all the\ncases.\n\nAll methods return the $sender object if they succeed.\n\nP.S.: The dieonerrors option is deprecated. You may still use it, but it may be removed in\nfuture versions!\n"
                    },
                    {
                        "name": "Return codes",
                        "content": "ref to a Mail::Sender object =  success\n\n-1 = $smtphost unknown\n-2 = socket() failed\n-3 = connect() failed\n-4 = service not available\n-5 = unspecified communication error\n-6 = local user $to unknown on host $smtp\n-7 = transmission of message failed\n-8 = argument $to empty\n-9 = no message specified in call to MailMsg or MailFile\n-10 = no file name specified in call to SendFile or MailFile\n-11 = file not found\n-12 = not available in singlepart mode\n-13 = site specific error\n-14 = connection not established. Did you mean MailFile instead of SendFile?\n-15 = no SMTP server specified\n-16 = no From: address specified\n-17 = authentication protocol not accepted by the server\n-18 = login not accepted\n-19 = authentication protocol is not implemented\n\n$Mail::Sender::Error contains a textual description of last error.\n"
                    }
                ]
            },
            "METHODS": {
                "content": "",
                "subsections": [
                    {
                        "name": "Open",
                        "content": "Open([from [, replyto [, to [, smtp [, subject [, headers]]]]]])\nOpen({[from => \"somebody@somewhere.com\"] , [to => \"else@nowhere.com\"] [...]})\n\nOpens a new message. If some parameters are unspecified or empty, it uses the parameters passed\nto the \"\"$Sender=new Mail::Sender(...)\"\";\n\nSee \"new Mail::Sender\" for info about the parameters.\n\nThe only additional parameter that may not be specified directly in the \"new Mail::Sender\" is\nmessageid. If you set this option then the message will be sent with this Message-ID, otherwise\na new Message ID will be generated out of the sender's address, current date+time and a random\nnumber (or by the function you specified in the \"createmessageid\" option).\n\nAfter the message is sent \"$sender-<{messageid}\" will contain the Message-ID with which the\nmessage was sent.\n\nReturns ref to the Mail::Sender object if successfull.\n"
                    },
                    {
                        "name": "OpenMultipart",
                        "content": "OpenMultipart([from [, replyto [, to [, smtp [, subject [, headers [, boundary]]]]]]])\nOpenMultipart({[from => \"somebody@somewhere.com\"] , [to => \"else@nowhere.com\"] [...]})\n\nOpens a multipart message. If some parameters are unspecified or empty, it uses the parameters\npassed to the \"$Sender=new Mail::Sender(...)\".\n\nSee \"new Mail::Sender\" for info about the parameters.\n\nReturns ref to the Mail::Sender object if successfull.\n"
                    },
                    {
                        "name": "MailMsg",
                        "content": "MailMsg([from [, replyto [, to [, smtp [, subject [, headers]]]]]], message)\nMailMsg({[from => \"somebody@somewhere.com\"]\n[, to => \"else@nowhere.com\"] [...], msg => \"Message\"})\n\nSends a message. If a mail in $sender is opened it gets closed and a new mail is created and\nsent. $sender is then closed. If some parameters are unspecified or empty, it uses the\nparameters passed to the \"\"$Sender=new Mail::Sender(...)\"\";\n\nSee \"new Mail::Sender\" for info about the parameters.\n\nThe module was made so that you could create an object initialized with all the necesary options\nand then send several messages without need to specify the SMTP server and others each time. If\nyou need to send only one mail using MailMsg() or MailFile() you do not have to create a named\nobject and then call the method. You may do it like this :\n\n(new Mail::Sender)->MailMsg({smtp => 'mail.company.com', ...});\n\nReturns ref to the Mail::Sender object if successfull.\n"
                    },
                    {
                        "name": "MailFile",
                        "content": "MailFile([from [, replyto [, to [, smtp [, subject [, headers]]]]]], message, file(s))\nMailFile({[from => \"somebody@somewhere.com\"]\n[, to => \"else@nowhere.com\"] [...],\nmsg => \"Message\", file => \"File\"})\n\nSends one or more files by mail. If a mail in $sender is opened it gets closed and a new mail is\ncreated and sent. $sender is then closed. If some parameters are unspecified or empty, it uses\nthe parameters passed to the \"\"$Sender=new Mail::Sender(...)\"\";\n\nThe \"file\" parameter may be a \"filename\", a \"list, of, file, names\" or a \\@listoffilenames.\n\nsee \"new Mail::Sender\" for info about the parameters.\n\nJust keep in mind that parameters like ctype, charset and encoding will be used for the attached\nfile, not the body of the message. If you want to specify those parameters for the body you have\nto use bctype, bcharset and bencoding. Sorry.\n\nReturns ref to the Mail::Sender object if successfull.\n"
                    },
                    {
                        "name": "Send",
                        "content": "Send(@strings)\n\nPrints the strings to the socket. Doesn't add any end-of-line characters. Doesn't encode the\ndata! You should use \"\\r\\n\" as the end-of-line!\n\nUNLESS YOU ARE ABSOLUTELY SURE YOU KNOW WHAT YOU ARE DOING YOU SHOULD USE SendEnc() INSTEAD!\n\nReturns the object if successfull.\n"
                    },
                    {
                        "name": "SendLine",
                        "content": "SendLine(@strings)\n\nPrints the strings to the socket. Adds the end-of-line character at the end. Doesn't encode the\ndata! You should use \"\\r\\n\" as the end-of-line!\n\nUNLESS YOU ARE ABSOLUTELY SURE YOU KNOW WHAT YOU ARE DOING YOU SHOULD USE SendLineEnc() INSTEAD!\n\nReturns the object if successfull.\n\nprint\nAlias to SendEnc().\n\nKeep in mind that you can't write :\n\nprint $sender \"...\";\n\nyou have to use\n\n$sender->print(\"...\");\n\nIf you want to be able to print into the message as if it was a normal file handle take a look\nat \"GetHandle\"()\n"
                    },
                    {
                        "name": "SendEnc",
                        "content": "SendEnc(@strings)\n\nPrints the strings to the socket. Doesn't add any end-of-line characters.\n\nEncodes the text using the selected encoding (none/Base64/Quoted-printable)\n\nReturns the object if successfull.\n"
                    },
                    {
                        "name": "SendLineEnc",
                        "content": "SendLineEnc(@strings)\n\nPrints the strings to the socket and adds the end-of-line character at the end. Encodes the text\nusing the selected encoding (none/Base64/Quoted-printable).\n\nDo NOT mix up /Send(Line)?(Ex)?/ and /Send(Line)?Enc/! SendEnc does some buffering necessary for\ncorrect Base64 encoding, and /Send(Ex)?/ is not aware of that!\n\nUsage of /Send(Line)?(Ex)?/ in non xBIT parts not recommended. Using\n\"Send(encodebase64($string))\" may work, but more likely it will not! In particular if you use\nseveral such to create one part, the data is very likely to get crippled.\n\nReturns the object if successfull.\n"
                    },
                    {
                        "name": "SendEx",
                        "content": "SendEx(@strings)\n\nPrints the strings to the socket. Doesn't add any end-of-line characters. Changes all\nend-of-lines to \"\\r\\n\". Doesn't encode the data!\n\nUNLESS YOU ARE ABSOLUTELY SURE YOU KNOW WHAT YOU ARE DOING YOU SHOULD USE SendEnc() INSTEAD!\n\nReturns the object if successfull.\n"
                    },
                    {
                        "name": "SendLineEx",
                        "content": "SendLineEx(@strings)\n\nPrints the strings to the socket. Adds an end-of-line character at the end. Changes all\nend-of-lines to \"\\r\\n\". Doesn't encode the data!\n\nUNLESS YOU ARE ABSOLUTELY SURE YOU KNOW WHAT YOU ARE DOING YOU SHOULD USE SendEnc() INSTEAD!\n\nReturns the object if successfull.\n"
                    },
                    {
                        "name": "Part",
                        "content": "Part( I<description>, I<ctype>, I<encoding>, I<disposition> [, I<contentid> [, I<msg>]]);\nPart( {[description => \"desc\"], [ctype => \"content-type\"], [encoding => \"...\"],\n[disposition => \"...\"], [contentid => \"...\"], [msg => ...]});\n\nPrints a part header for the multipart message and (if specified) the contents. The undefined or\nempty variables are ignored.\n\ndescription\nThe title for this part.\n\nctype\nthe content type (MIME type) of this part. May contain some other parameters, such as charset\nor name.\n\nDefaults to \"application/octet-stream\".\n\nSince 0.8.00 you may use even \"multipart/...\" types. Such a multipart part should be closed by\na call to $sender->EndPart($ctype).\n\n...\n$sender->Part({ctype => \"multipart/related\", ...});\n$sender->Part({ctype => 'text/html', ...});\n$sender->Attach({file => 'someimage.gif', contentid => 'foo', ...});\n$sender->EndPart(\"multipart/related\");\n...\n\nPlease see the examples below.\n\nencoding\nthe encoding used for this part of message. Eg. Base64, Uuencode, 7BIT ...\n\nDefaults to \"7BIT\".\n\ndisposition\nThis parts disposition. Eg: 'attachment; filename=\"send.pl\"'.\n\nDefaults to \"attachment\". If you specify \"none\" or \"\", the Content-disposition: line will not\nbe included in the headers.\n\ncontentid\nThe content id of the part, used in multipart/related. If not specified, the header is not\nincluded.\n\nmsg\nThe content of the part. You do not have to specify the content here, you may use SendEnc() to\nadd content to the part.\n\ncharset\nThe charset of the part.\n\nReturns the Mail::Sender object if successfull, negative error code if not.\n"
                    },
                    {
                        "name": "Body",
                        "content": "Body([charset [, encoding [, content-type]]]);\nBody({charset => '...', encoding => '...', ctype => '...', msg => '...');\n\nSends the head of the multipart message body. You can specify the charset and the encoding.\nDefault is \"US-ASCII\",\"7BIT\",'text/plain'.\n\nIf you pass undef or zero as the parameter, this function uses the default value:\n\nBody(0,0,'text/html');\n\nReturns the Mail::Sender object if successfull, negative error code if not. You should NOT use\nthis method in single part messages, that is, it works after OpenMultipart(), but has no meaning\nafter Open()!\n"
                    },
                    {
                        "name": "SendFile",
                        "content": "Alias to Attach()\n"
                    },
                    {
                        "name": "Attach",
                        "content": "Attach( I<description>, I<ctype>, I<encoding>, I<disposition>, I<file>);\nAttach( { [description => \"desc\"] , [ctype => \"ctype\"], [encoding => \"encoding\"],\n[disposition => \"disposition\"], file => \"file\"});\n\nSends a file as a separate part of the mail message. Only in multipart mode.\n\ndescription\nThe title for this part.\n\nctype\nthe content type (MIME type) of this part. May contain some other parameters, such as charset\nor name.\n\nDefaults to \"application/octet-stream\".\n\nencoding\nthe encoding used for this part of message. Eg. Base64, Uuencode, 7BIT ...\n\nDefaults to \"Base64\".\n\ndisposition\nThis parts disposition. Eg: 'attachment; filename=\"send.pl\"'. If you use 'attachment;\nfilename=*' the * will be replaced by the respective names of the sent files.\n\nDefaults to \"attachment; filename=*\". If you do not want to include this header use \"\" as the\nvalue.\n\nfile\nThe name of the file to send or a 'list, of, names' or a\n['reference','to','a','list','of','filenames']. Each file will be sent as a separate part.\n\nPlease keep in mind that if you pass a string as this parameter the module will split it on\ncommas! If your filenames may contain commas and you want to be sure they are sent correctly\nyou have to use the reference to array format:\n\nfile => [ $filename],\n\ncontentid\nThe content id of the message part. Used in multipart/related.\n\nSpecial values:\n\"*\" => the name of the file\n\"#\" => autoincremented number (starting from 0)\n\nReturns the Mail::Sender object if successfull, negative error code if not.\n"
                    },
                    {
                        "name": "EndPart",
                        "content": "$sender->EndPart($ctype);\n\nCloses a multipart part.\n\nIf the $ctype is not present or evaluates to false, only the current SIMPLE part is closed!\nDon't do that unless you are really sure you know what you are doing.\n\nIt's best to always pass to the ->EndPart() the content type of the corresponding ->Part().\n"
                    },
                    {
                        "name": "Close",
                        "content": "$sender->Close;\n$sender->Close(1);\n\nClose and send the email message. If you pass a true value to the method the connection will be\nclosed even if the \"keepconnection\" was specified. You should only keep the connection open if\nyou plan to send another message immediately. And you should not keep it open for hundreds of\nemails even if you do send them all in a row.\n\nThis method should be called automatically when destructing the object, but you should not rely\non it. If you want to be sure your message WAS processed by the SMTP server you SHOULD call\nClose() explicitely.\n\nReturns the Mail::Sender object if successfull, negative error code if not, zero if $sender was\nnot connected at all. The zero usualy means that the Open/OpenMultipart failed and you did not\ntest its return value.\n"
                    },
                    {
                        "name": "Cancel",
                        "content": "$sender->Cancel;\n\nCancel an opened message.\n\nSendFile and other methods may set $sender->{'error'}. In that case \"undef $sender\" calls\n\"$sender-\">Cancel not \"$sender-\">Close!!!\n\nReturns the Mail::Sender object if successfull, negative error code if not.\n"
                    },
                    {
                        "name": "QueryAuthProtocols",
                        "content": "@protocols = $sender->QueryAuthProtocols();\n@protocols = $sender->QueryAuthProtocols( $smtpserver);\n\nQueryies the server (specified either in the default options for Mail::Sender, the \"new\nMail::Sender\" command or as a parameter to this method for the authentication protocols it\nsupports.\n"
                    },
                    {
                        "name": "GetHandle",
                        "content": "Returns a \"filehandle\" to which you can print the message or file to attach or whatever. The\ndata you print to this handle will be encoded as necessary. Closing this handle closes either\nthe message (for single part messages) or the part.\n\n$sender->Open({...});\nmy $handle = $sender->GetHandle();\nprint $handle \"Hello world.\\n\"\nmy ($mday,$mon,$year) = (localtime())[3,4,5];\nprintf $handle \"Today is %04d/%02d/%02d.\", $year+1900, $mon+1, $mday;\nclose $handle;\n\nP.S.: There is a big difference between the handle stored in $sender->{'socket'} and the handle\nreturned by this function ! If you print something to $sender->{'socket'} it will be sent to the\nserver without any modifications, encoding, escaping, ... You should NOT touch the\n$sender->{'socket'} unless you really really know what you are doing.\n"
                    }
                ]
            },
            "FUNCTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "GuessCType",
                        "content": "$ctype = GuessCType $filename, $filepath;\n\nGuesses the content type based on the filename or the file contents. This function is used when\nyou attach a file and do not specify the content type. It is not exported by default!\n\nThe builtin version uses the filename extension to guess the type. Currently there are only a\nfew extensions defined, you may add other extensions this way:\n\n$Mail::Sender::CTypes{'EXT'} = 'content/type';\n...\n\nThe extension has to be in UPPERCASE and will be matched case sensitively.\n\nThe package now includes two addins improving the guesswork. If you \"use\" one of them in your\nscript, it replaces the builtin GuessCType() subroutine with a better one:\n\nMail::Sender::CType::Win32\nWin32 only, the content type is read from the registry\nMail::Sender::CType::Ext\nany OS, a longer list of extensions from A. Guillaume\n"
                    },
                    {
                        "name": "ResetGMTdiff",
                        "content": "ResetGMTdiff()\n\nThe module computes the local vs. GMT time difference to include in the timestamps added into\nthe message headers. As the time difference may change due to summer savings time changes you\nmay want to reset the time difference ocassionaly in long running programs.\n"
                    }
                ]
            },
            "CONFIG": {
                "content": "If you create a file named Sender.config in the same directory where Sender.pm resides, this\nfile will be \"require\"d as soon as you \"use Mail::Sender\" in your script. Of course the\nSender.config MUST \"return a true value\", that is it has to be succesfully compiled and the last\nstatement must return a true value. You may use this to forbide the use of Mail::Sender to some\nusers.\n\nYou may define the default settings for new Mail::Sender objects and do a few more things.\n\nThe default options are stored in hash %Mail::Sender::default. You may use all the options you'd\nuse in \"new\", \"Open\", \"OpenMultipart\", \"MailMsg\" or \"MailFile\".\n\nEg.\n%default = (\nsmtp => 'mail.yourhost.cz',\nfrom => getlogin.'yourhost.cz',\nclient => getlogin.'.yourhost.cz'\n);\n# of course you will use your own mail server here !\n\nThe other options you may set here (or later of course) are $Mail::Sender::SITEHEADERS,\n$Mail::Sender::NOXMAILER and $Mail::Sender::NODATE. (These are plain old scalar variables,\nthere is no function or method for modifying them. Just set them to anything you need.)\n\nThe $Mail::Sender::SITEHEADERS may contain headers that will be added to each mail message sent\nby this script, the $Mail::Sender::NOXMAILER disables the header item specifying that the\nmessage was sent by Mail::Sender and $Mail::Sender::NODATE turns off the Date: header\ngeneration.\n\n!!! $Mail::Sender::SITEHEADERS may NEVER end with \\r\\n !!!\n\nIf you want to set the $Mail::Sender::SITEHEADERS for every script sent from your server\nwithout your users being able to change it you may use this hack:\n\n$loginname = somethingthatidentifiestheuser();\n*Mail::Sender::SITEHEADERS = \\\"X-Sender: $loginname via $0\";\n$Mail::Sender::NOXMAILER = 1;\n\nYou may even \"install\" your custom function that will be evaluated for each message just before\ncontacting the server. You may change all the options from within as well as stop sending the\nmessage.\n\nAll you have to do is to create a function named SiteHook in Mail::Sender package. This function\nwill get the Mail::Sender object as its first argument. If it returns a TRUE value the message\nis sent, if it returns FALSE the sending is canceled and the user gets \"Site specific error\"\nerror message.\n\nIf you want to give some better error message you may do it like this :\n\nsub SiteHook {\nmy $self = shift;\nif (whatever($self)) {\n$self->Error( SITEERROR);\n$Mail::Sender::Error = \"I don't like this mail\";\nreturn 0\n} else {\nreturn 1;\n}\n}\n\nThis example will ensure the from address is the users real address :\n\nsub SiteHook {\nmy $self = shift;\n$self->{'fromaddr'} = getlogin.'@yoursite.com';\n$self->{'from'} = getlogin.'@yoursite.com';\n1;\n}\n\nPlease note that at this stage the from address is in two different object properties.\n\n$self->{'from'} is the address as it will appear in the mail, that is it may include the full\nname of the user or any other comment ( \"Jan Krynicky <jenda@krynicky.cz>\" for example), while\nthe $self->{'fromaddr'} is realy just the email address per se and it will be used in\nconversation with the SMTP server. It must be without comments (\"jenda@krynicky.cz\" for\nexample)!\n\nWithout write access to .../lib/Mail/Sender.pm or .../lib/Mail/Sender.config your users will\nthen be unable to get rid of this header. Well ... everything is doable, if they are cheeky\nenough ... :-(\n\nSo if you take care of some site with virtual servers for several clients and implement some\npolicy via SiteHook() or $Mail::Sender::SITEHEADERS search the clients' scripts for \"SiteHook\"\nand \"SITEHEADERS\" from time to time. To see who's cheating.\n",
                "subsections": []
            },
            "AUTHENTICATION": {
                "content": "If you get a \"Local user \"xxx@yyy.com\" unknown on host \"zzz\"\" message it usualy means that your\nmail server is set up to forbid mail relay. That is it only accepts messages to or from a local\nuser. If you need to be able to send a message with both the sender's and recipient's address\nremote, you need to somehow authenticate to the server. You may need the help of the mail\nserver's administrator to find out what username and password and/or what authentication\nprotocol are you supposed to use.\n\nThere are many authentication protocols defined for ESTMP, Mail::Sender natively supports only\nPLAIN, LOGIN, CRAM-MD5 and NTLM (please see the docs for \"new Mail::Sender\").\n\nIf you want to know what protocols are supported by your server you may get the list by this:\n\n/tmp# perl -MMail::Sender -e 'Mail::Sender->printAuthProtocols(\"the.server.com\")'\nor\nc:\\> perl -MMail::Sender -e \"Mail::Sender->printAuthProtocols('the.server.com')\"\n\nThere is one more way to authenticate. Some servers want you to login by POP3 before you can\nsend a message. You have to use Net::POP3 or Mail::POP3Client to do this.\n",
                "subsections": [
                    {
                        "name": "Other protocols",
                        "content": "It is possible to add new authentication protocols to Mail::Sender. All you have to do is to\ndefine a function Mail::Sender::Auth::PROTOCOLNAME that will implement the login. The function\ngets one parameter ... the Mail::Sender object. It can access these properties:\n\n$obj->{'socket'} : the socket to print to and read from\nyou may use the sendcmd() function to send a request\nand read a response from the server\n$obj->{'authid'} : the username specified in the new Mail::Sender,\nOpen or OpenMultipart call\n$obj->{'authpwd'} : the password\n$obj->{auth...} : all unknown parameters passed to the constructor or the mail\nopening/creation methods are preserved in the object. If the protocol requires\nany other options, please use names starting with \"auth\". Eg. \"authdomain\", ...\n$obj->{'error'} : this should be set to a negative error number. Please use numbers\nbelow -1000 for custom errors.\n$obj->{'errormsg'} : this should be set to the error message\n\nIf the login fails you should\n1) Set $Mail::Sender::Error to the error message\n2) Set $obj->{'errormsg'} to the error message\n2) Set $obj->{'error'} to a negative number\n3) return a negative number\nIf it succeeds, please return \"nothing\" :\nreturn;\n\nPlease use the protocols defined within Sender.pm as examples.\n"
                    }
                ]
            },
            "EXAMPLES": {
                "content": "",
                "subsections": [
                    {
                        "name": "Object creation",
                        "content": "ref ($sender = new Mail::Sender { from => 'somebody@somewhere.com',\nsmtp => 'mail.yourISP.com', boundary => 'This-is-a-mail-boundary-435427'})\nor die \"Error in mailing : $Mail::Sender::Error\\n\";\n\nor\n\nmy $sender = new Mail::Sender { ... };\ndie \"Error in mailing : $Mail::Sender::Error\\n\" unless ref $sender;\n\nor\n\nmy $sender = new Mail::Sender { ..., onerrors => 'undef' }\nor die \"Error in mailing : $Mail::Sender::Error\\n\";\n\nYou may specify the options either when creating the Mail::Sender object or later when you open\na message. You may also set the default options when installing the module (See \"CONFIG\"\nsection). This way the admin may set the SMTP server and even the authentication options and the\nusers do not have to specify it again.\n\nYou should keep in mind that the way Mail::Sender reports failures depends on the 'onerrors'=>\noption. If you set it to 'die' it throws an exception, if you set it to \"undef\" or 'undef' it\nreturns undef and otherwise it returns a negative error code!\n"
                    },
                    {
                        "name": "Simple single part message",
                        "content": "$sender = new Mail::Sender {\nsmtp => 'mail.yourISP.com',\nfrom => 'somebody@somewhere.com',\nonerrors => undef,\n}\nor die \"Can't create the Mail::Sender object: $Mail::Sender::Error\\n\";\n$sender->Open({\nto => 'mama@home.org, papa@work.com',\ncc => 'somebody@somewhere.com',\nsubject => 'Sorry, I\\'ll come later.'\n})\nor die \"Can't open the message: $sender->{'errormsg'}\\n\";\n$sender->SendLineEnc(\"I'm sorry, but thanks to the lusers,\nI'll come at 10pm at best.\");\n$sender->SendLineEnc(\"\\nHi, Jenda\");\n$sender->Close()\nor die \"Failed to send the message: $sender->{'errormsg'}\\n\";\n\nor\n\neval {\n$sender = new Mail::Sender {\nsmtp => 'mail.yourISP.com',\nfrom => 'somebody@somewhere.com',\nonerrors => 'die',\n};\n$sender->Open({\nto => 'mama@home.org, papa@work.com',\ncc => 'somebody@somewhere.com',\nsubject => 'Sorry, I\\'ll come later.'\n});\n$sender->SendLineEnc(\"I'm sorry, but thanks to the lusers,\nI'll come at 10pm at best.\");\n$sender->SendLineEnc(\"\\nHi, Jenda\");\n$sender->Close();\n};\nif ($@) {\ndie \"Failed to send the message: $@\\n\";\n}\n\nor\n\n$sender = new Mail::Sender {\nsmtp => 'mail.yourISP.com',\nfrom => 'somebody@somewhere.com',\nonerrors => 'code',\n};\ndie \"Can't create the Mail::Sender object: $Mail::Sender::Error\\n\"\nunless ref $sender;\nref $sender->Open({\nto => 'mama@home.org, papa@work.com',\ncc => 'somebody@somewhere.com',\nsubject => 'Sorry, I\\'ll come later.'\n})\nor die \"Can't open the message: $sender->{'errormsg'}\\n\";\n$sender->SendLineEnc(\"I'm sorry, but thanks to the lusers,\nI'll come at 10pm at best.\");\n$sender->SendLineEnc(\"\\nHi, Jenda\");\nref $sender->Close\nor die \"Failed to send the message: $sender->{'errormsg'}\\n\";\n\nUsing GetHandle()\nref $sender->Open({to => 'friend@other.com', subject => 'Hello dear friend'})\nor die \"Error: $Mail::Sender::Error\\n\";\nmy $FH = $sender->GetHandle();\nprint $FH \"How are you?\\n\\n\";\nprint $FH <<'*END*';\nI've found these jokes.\n\nDoctor, I feel like a pack of cards.\nSit down and I'll deal with you later.\n\nDoctor, I keep thinking I'm a dustbin.\nDon't talk rubbish.\n\nHope you like'em. Jenda\n*END*\n\n$sender->Close;\n# or\n# close $FH;\n\nor\n\neval {\n$sender->Open({ onerrors => 'die',\nto => 'mama@home.org, papa@work.com',\ncc => 'somebody@somewhere.com',\nsubject => 'Sorry, I\\'ll come later.'});\n$sender->SendLineEnc(\"I'm sorry, but due to a big load of work,\nI'll come at 10pm at best.\");\n$sender->SendLineEnc(\"\\nHi, Jenda\");\n$sender->Close;\n};\nif ($@) {\nprint \"Error sending the email: $@\\n\";\n} else {\nprint \"The mail was sent.\\n\";\n}\n"
                    },
                    {
                        "name": "Multipart message with attachment",
                        "content": "$sender->OpenMultipart({to => 'Perl-Win32-Users@activeware.foo',\nsubject => 'Mail::Sender.pm - new module'});\n$sender->Body;\n$sender->SendEnc(<<'*END*');\nHere is a new module Mail::Sender.\nIt provides an object based interface to sending SMTP mails.\nIt uses a direct socket connection, so it doesn't need any\nadditional program.\n\nEnjoy, Jenda\n*END*\n$sender->Attach(\n{description => 'Perl module Mail::Sender.pm',\nctype => 'application/x-zip-encoded',\nencoding => 'Base64',\ndisposition => 'attachment; filename=\"Sender.zip\"; type=\"ZIP archive\"',\nfile => 'sender.zip'\n});\n$sender->Close;\n\nor\n\n$sender->OpenMultipart({to => 'Perl-Win32-Users@activeware.foo',\nsubject => 'Mail::Sender.pm - new version'});\n$sender->Body({ msg => <<'*END*' });\nHere is a new module Mail::Sender.\nIt provides an object based interface to sending SMTP mails.\nIt uses a direct socket connection, so it doesn't need any\nadditional program.\n\nEnjoy, Jenda\n*END*\n$sender->Attach(\n{description => 'Perl module Mail::Sender.pm',\nctype => 'application/x-zip-encoded',\nencoding => 'Base64',\ndisposition => 'attachment; filename=\"Sender.zip\"; type=\"ZIP archive\"',\nfile => 'sender.zip'\n});\n$sender->Close;\n\nor (in case you have the file contents in a scalar)\n\n$sender->OpenMultipart({to => 'Perl-Win32-Users@activeware.foo',\nsubject => 'Mail::Sender.pm - new version'});\n$sender->Body({ msg => <<'*END*' });\nHere is a new module Mail::Sender.\nIt provides an object based interface to sending SMTP mails.\nIt uses a direct socket connection, so it doesn't need any\nadditional program.\n\nEnjoy, Jenda\n*END*\n$sender->Part(\n{description => 'Perl module Mail::Sender.pm',\nctype => 'application/x-zip-encoded',\nencoding => 'Base64',\ndisposition => 'attachment; filename=\"Sender.zip\"; type=\"ZIP archive\"',\nmsg => $senderzipcontents,\n});\n$sender->Close;\n\nUsing exceptions (no need to test return values after each function)\nuse Mail::Sender;\neval {\n(new Mail::Sender {onerrors => 'die'})\n->OpenMultipart({smtp=> 'jenda.krynicky.cz', to => 'jenda@krynicky.cz',subject => 'Mail::Sender.pm - new version'})\n->Body({ msg => <<'*END*' })\nHere is a new module Mail::Sender.\nIt provides an object based interface to sending SMTP mails.\nIt uses a direct socket connection, so it doesn't need any\nadditional program.\n\nEnjoy, Jenda\n*END*\n->Attach({\ndescription => 'Perl module Mail::Sender.pm',\nctype => 'application/x-zip-encoded',\nencoding => 'Base64',\ndisposition => 'attachment; filename=\"Sender.zip\"; type=\"ZIP archive\"',\nfile => 'W:\\jenda\\packages\\Mail\\Sender\\Mail-Sender-0.7.14.3.tar.gz'\n})\n->Close();\n} or print \"Error sending mail: $@\\n\";\n\nUsing MailMsg() shortcut to send simple messages\nIf everything you need is to send a simple message you may use:\n\nif (ref ($sender->MailMsg({to =>'Jenda@Krynicky.czX', subject => 'this is a test',\nmsg => \"Hi Johnie.\\nHow are you?\"}))) {\nprint \"Mail sent OK.\"\n} else {\ndie \"$Mail::Sender::Error\\n\";\n}\n\nor\n\nif ($sender->MailMsg({\nsmtp => 'mail.yourISP.com',\nfrom => 'somebody@somewhere.com',\nto =>'Jenda@Krynicky.czX',\nsubject => 'this is a test',\nmsg => \"Hi Johnie.\\nHow are you?\"\n}) < 0) {\ndie \"$Mail::Sender::Error\\n\";\n}\nprint \"Mail sent OK.\"\n"
                    },
                    {
                        "name": "Using MailMsg and authentication",
                        "content": "if ($sender->MailMsg({\nsmtp => 'mail.yourISP.com',\nfrom => 'somebody@somewhere.com',\nto =>'Jenda@Krynicky.czX',\nsubject => 'this is a test',\nmsg => \"Hi Johnie.\\nHow are you?\"\nauth => 'NTLM',\nauthid => 'jenda',\nauthpwd => 'benda',\n}) < 0) {\ndie \"$Mail::Sender::Error\\n\";\n}\nprint \"Mail sent OK.\"\n\nUsing MailFile() shortcut to send an attachment\nIf you want to attach some files:\n\n(ref ($sender->MailFile(\n{to =>'you@address.com', subject => 'this is a test',\nmsg => \"Hi Johnie.\\nI'm sending you the pictures you wanted.\",\nfile => 'image1.jpg,image2.jpg'\n}))\nand print \"Mail sent OK.\"\n)\nor die \"$Mail::Sender::Error\\n\";\n"
                    },
                    {
                        "name": "Sending HTML messages",
                        "content": "If you are sure the HTML doesn't contain any accentuated characters (with codes above 127).\n\nopen IN, $htmlfile or die \"Cannot open $htmlfile : $!\\n\";\n$sender->Open({ from => 'your@address.com', to => 'other@address.com',\nsubject => 'HTML test',\nctype => \"text/html\",\nencoding => \"7bit\"\n}) or die $Mail::Sender::Error,\"\\n\";\n\nwhile (<IN>) { $sender->SendEx($) };\nclose IN;\n$sender->Close();\n\nOtherwise use SendEnc() instead of SendEx() and \"quoted-printable\" instead of \"7bit\".\n\nAnother ... quicker way ... would be:\n\nopen IN, $htmlfile or die \"Cannot open $htmlfile : $!\\n\";\n$sender->Open({ from => 'your@address.com', to => 'other@address.com',\nsubject => 'HTML test',\nctype => \"text/html\",\nencoding => \"quoted-printable\"\n}) or die $Mail::Sender::Error,\"\\n\";\n\nwhile (read IN, $buff, 4096) { $sender->SendEnc($buff) };\nclose IN;\n$sender->Close();\n"
                    },
                    {
                        "name": "Sending HTML messages with inline images",
                        "content": "if (ref $sender->OpenMultipart({\nfrom => 'someone@somewhere.net', to => $recipients,\nsubject => 'Embedded Image Test',\nboundary => 'boundary-test-1',\nmultipart => 'related'})) {\n$sender->Attach(\n{description => 'html body',\nctype => 'text/html; charset=us-ascii',\nencoding => '7bit',\ndisposition => 'NONE',\nfile => 'test.html'\n});\n$sender->Attach({\ndescription => 'ed\\'s gif',\nctype => 'image/gif',\nencoding => 'base64',\ndisposition => \"inline; filename=\\\"apachepb.gif\\\";\\r\\nContent-ID: <img1>\",\nfile => 'apachepb.gif'\n});\n$sender->Close() or die \"Close failed! $Mail::Sender::Error\\n\";\n} else {\ndie \"Cannot send mail: $Mail::Sender::Error\\n\";\n}\n\nAnd in the HTML you'll have this : ... <IMG src=\"cid:img1\"> ... on the place where you want the\ninlined image.\n\nPlease keep in mind that the image name is unimportant, it's the Content-ID what counts!\n\n# or using the eval{ $obj->Method()->Method()->...->Close()} trick ...\n\nuse Mail::Sender;\neval {\n(new Mail::Sender)\n->OpenMultipart({\nto => 'someone@somewhere.com',\nsubject => 'Embedded Image Test',\nboundary => 'boundary-test-1',\ntype => 'multipart/related'\n})\n->Attach({\ndescription => 'html body',\nctype => 'text/html; charset=us-ascii',\nencoding => '7bit',\ndisposition => 'NONE',\nfile => 'c:\\temp\\zk\\HTMLTest.htm'\n})\n->Attach({\ndescription => 'Test gif',\nctype => 'image/gif',\nencoding => 'base64',\ndisposition => \"inline; filename=\\\"test.gif\\\";\\r\\nContent-ID: <img1>\",\nfile => 'test.gif'\n})\n->Close()\n}\nor die \"Cannot send mail: $Mail::Sender::Error\\n\";\n"
                    },
                    {
                        "name": "Sending message with plaintext and HTML alternatives",
                        "content": "use Mail::Sender;\n\neval {\n(new Mail::Sender)\n->OpenMultipart({\nto => 'someone@somewhere.com',\nsubject => 'Alternatives',\n#               debug => 'c:\\temp\\zkMailFlow.log',\nmultipart => 'mixed',\n})\n->Part({ctype => 'multipart/alternative'})\n->Part({ ctype => 'text/plain', disposition => 'NONE', msg => <<'*END*' })\nA long\nmail\nmessage.\n*END*\n->Part({ctype => 'text/html', disposition => 'NONE', msg => <<'*END*'})\n<html><body><h1>A long</h1><p align=center>\nmail\nmessage.\n</p></body></html>\n*END*\n->EndPart(\"multipart/alternative\")\n->Close();\n} or print \"Error sending mail: $Mail::Sender::Error\\n\";\n"
                    },
                    {
                        "name": "Sending message with plaintext and HTML alternatives with inline images",
                        "content": "use Mail::Sender;\n\neval {\n(new Mail::Sender)\n->OpenMultipart({\nto => 'someone@somewhere.com',\nsubject => 'Alternatives with images',\n#               debug => 'c:\\temp\\zkMailFlow.log',\nmultipart => 'related',\n})\n->Part({ctype => 'multipart/alternative'})\n->Part({ ctype => 'text/plain', disposition => 'NONE', msg => <<'*END*' })\nA long\nmail\nmessage.\n*END*\n->Part({ctype => 'text/html', disposition => 'NONE', msg => <<'*END*'})\n<html><body><h1>A long</h1><p align=center>\nmail\nmessage.\n<img src=\"cid:img1\">\n</p></body></html>\n*END*\n->EndPart(\"multipart/alternative\")\n->Attach({\ndescription => 'ed\\'s jpg',\nctype => 'image/jpeg',\nencoding => 'base64',\ndisposition => \"inline; filename=\\\"0518mb.jpg\\\";\\r\\nContent-ID: <img1>\",\nfile => 'E:\\pix\\humor\\0518mb.jpg'\n})\n->Close();\n} or print \"Error sending mail: $Mail::Sender::Error\\n\";\n\nKeep in mind please that different mail clients display messages differently. You may need to\ntry several ways to create messages so that they appear the way you need. These two examples\nlooked like I expected in Pegasus Email and MS Outlook.\n\nIf this doesn't work with your mail client, please let me know and we might find a way.\n"
                    },
                    {
                        "name": "Sending a file that was just uploaded from an HTML form",
                        "content": "use CGI;\nuse Mail::Sender;\n\n$query = new CGI;\n\n# uploading the file...\n$filename = $query->param('mailformFile');\nif ($filename ne \"\"){\n$tmpfile = $query->tmpFileName($filename);\n}\n\n$sender = new Mail::Sender {from => 'script@krynicky.cz',smtp => 'mail.krynicky.czX'};\n$sender->OpenMultipart({to=> 'jenda@krynicky.czX',subject=> 'test CGI attach'});\n$sender->Body();\n$sender->Send(<<\"*END*\");\nThis is just a test of mail with an uploaded file.\n\nJenda\n*END*\n$sender->Attach({\nencoding => 'Base64',\ndescription => $filename,\nctype => $query->uploadInfo($filename)->{'Content-Type'},\ndisposition => \"attachment; filename = $filename\",\nfile => $tmpfile\n});\n$sender->Close();\n\nprint \"Content-type: text/plain\\n\\nYes, it's sent\\n\\n\";\n"
                    },
                    {
                        "name": "Listing the authentication protocols supported by the server",
                        "content": "use Mail::Sender;\nmy $sender = new Mail::Sender {smtp => 'localhost'};\ndie \"Error: $Mail::Sender::Error\\n\" unless ref $sender;\nprint join(', ', $sender->QueryAuthProtocols()),\"\\n\";\n\nor (if you have Mail::Sender 0.8.05 or newer)\n\nuse Mail::Sender;\nprint join(', ', Mail::Sender->QueryAuthProtocols('localhost')),\"\\n\";\n\nor\n\nuse Mail::Sender;\nprint join(', ', Mail::Sender::QueryAuthProtocols('localhost')),\"\\n\";\n\nFAQ\nForwarding the messages created by Mail::Sender removes accents. Why?\nThe most likely colprit is missing or incorrect charset specified for the body or a part of the\nemail. You should add something like\n\ncharset => 'iso-8859-1',\nencoding => 'quoted-printable',\n\nto the parameters passed to Open(), OpenMultipart(), MailMsg(), Body() or Part() or\n\nbcharset => 'iso-8859-1',\nbencoding => 'quoted-printable',\n\nto the parameters for MailFile().\n\nIf you use a different charset ('iso-8859-2', 'win-1250', ...) you will of course need to\nspecify that charset. If you are not sure, try to send a mail with some other mail client and\nthen look at the message/part headers.\n"
                    },
                    {
                        "name": "Sometimes there is an equals sign at the end of an attached file when",
                        "content": "I open the email in Outlook. What's wrong?\nOutlook is. It has (had) a bug in its quoted printable decoding routines. This problem happens\nonly in quoted-printable encoded parts on multipart messages. And only if the data in that part\ndo not end with a newline. (This is new in 0.8.08, in older versions it happened in all QP\nencoded parts.)\n\nThe problem is that an equals sign at the end of a line in a quoted printable encoded text means\n\"ignore the newline\". That is\n\nfooo sdfg sdfg sdfh dfh =\ndfsgdsfg\n\nshould be decoded as\n\nfooo sdfg sdfg sdfh dfh dfsgdsfg\n\nThe problem is at the very end of a file. The part boundary (text separating different parts of\na multipart message) has to start on a new line, if the attached file ends by a newline\neverything is cool. If it doesn't I need to add a newline and to denote that the newline is not\npart of the original file I add an equals:\n\ndfgd dsfgh dfh dfh dfhdfhdfhdfgh\nthis is the last line.=\n--message-boundary-146464--\n\nOtherwise I'd add a newline at the end of the file. If you do not care about the newline and\nwant to be sure Outlook doesn't add the equals to the file add\n\nbypassoutlookbug => 1\n\nparameter to \"new Mail::Sender\" or \"Open\"/\"OpenMultipart\".\n\nWARNING\nDO NOT mix Open(Multipart)|Send(Line)(Ex)|Close with MailMsg or MailFile. Both Mail(Msg/File)\nclose any Open-ed mail. Do not try this:\n\n$sender = new Mail::Sender ...;\n$sender->OpenMultipart...;\n$sender->Body;\n$sender->Send(\"...\");\n$sender->MailFile({file => 'something.ext');\n$sender->Close;\n\nThis WON'T work!!!\n\nGOTCHAS\nLocal user \"someone@somewhere.com\" doesn't exist\n\"Thanks\" to spammers mail servers usualy do not allow just anyone to post a message through\nthem. Most often they require that either the sender or the recipient is local to the server\n\nMail::Sendmail works, Mail::Sender doesn't\nIf you are able to connect to the mail server and scripts using Mail::Sendmail work, but\nMail::Sender fails with \"connect() failed\", please review the settings in /etc/services. The\nport for SMTP should be 25.\n\n$/ and $\\\nIf you change the $/ ($RS, $INPUTRECORDSEPARATOR) or $\\ ($ORS, $OUTPUTRECORDSEPARATOR) or $,\n($OFS, $OUTPUTFIELDSEPARATOR) Mail::Sender may stop working! Keep in mind that those variables\nare global and therefore they change the behaviour of <> and print everywhere. And since the\nSMTP is a plain text protocol if you change the notion of lines you can break it.\n\nIf you have to fiddle with $/, $\\ or $, do it in the smallest possible block of code and"
                    },
                    {
                        "name": "local",
                        "content": "open my $IN, '<', $filename or die \"Can't open $filename: $!\\n\";\nmy $data = do {local $/; <$IN>};\nclose $IN;\n"
                    }
                ]
            },
            "BUGS": {
                "content": "I'm sure there are many. Please let me know if you find any.\n\nThe problem with multiline responses from some SMTP servers (namely qmail) is solved. At last.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "MIME::Lite, MIME::Entity, Mail::Sendmail, Mail::Mailer, ...\n\nThere are lots of mail related modules on CPAN, with different capabilities and interfaces. You\nhave to find the right one yourself :-)\n",
                "subsections": []
            },
            "DISCLAIMER": {
                "content": "This module is based on SendMail.pm Version : 1.21 that appeared in\nPerl-Win32-Users@activeware.com mailing list. I don't remember the name of the poster and it's\nnot mentioned in the script. Thank you mr. \"undef\".\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Jan Krynicky <Jenda@Krynicky.cz> http://Jenda.Krynicky.cz\n\nWith help of Rodrigo Siqueira <rodrigo@insite.com.br>, Ed McGuigan <itstech1@gate.net>, John\nSanche <john@quadrant.net>, Brian Blakley <bblakley@mp5.net>, and others.\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright (c) 1997-2006 Jan Krynicky <Jenda@Krynicky.cz>. All rights reserved.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself. There is only one aditional condition, you may NOT use this module for SPAMing!\nNEVER! (see http://spam.abuse.net/ for definition)\n",
                "subsections": []
            }
        }
    }
}