title: Unable to submit email on port 465 using Net::SMTP module in Perl
body: <p>I want to submit email on port 465 of my smtp server using the Net::SMTP module(without using Net::SMTP::SSL) in a perl script from client. On Port 465 of my SMTP server, "submissions" service runs, which understands SMTPS.</p>
  
  <p>I have tried to find the way to do this on google. Then used the Net::SMTP::SSL module to make request on port 465. It works fine.</p>
  
  <p>But the documentation for <a href="https://metacpan.org/pod/Net::SMTP::SSL" rel="nofollow noreferrer">Net::SMTP::SSL</a> recommends using latest version Net::SMTP instead of using Net::SMTP::SSL.
  The document clearly states that</p>
  
  <blockquote>
    <p>Since Net::SMTP v1.28 (2014-10-08), Net::SMTP itself has support for
    SMTP over SSL, and also for STARTTLS. Use Net::SMTP, not
    Net::SMTP::SSL.</p>
  </blockquote>
  
  <p>I have updated Net::SMTP module to the latest version 3.11.</p>
  
  <p>Also the document for <a href="https://metacpan.org/pod/Net::SMTP" rel="nofollow noreferrer">Net::SMTP</a> also stated clearly that</p>
  
  <blockquote>
    <p>With IO::Socket::SSL installed it also provides support for implicit
    and explicit TLS encryption, i.e. SMTPS or SMTP+STARTTLS.</p>
  </blockquote>
  
  <p>The part of my perl script code on client ,relevant to the problem mentioned looks like so: </p>
  
  <pre><code>$smtp = Net::SMTP::SSL-&gt;new("$mailserver",
                          Hello =&gt; "$localhostname",
                          Timeout =&gt; 60,
                          Port =&gt; "$port",  //Port value is 465
                          Debug =&gt; 1);
   $smtp-&gt;auth($username, $password);
  </code></pre>
  
  <p>...Remaining script which sets sender, receiver body etc</p>
  
  <p>This works fine. The email gets submitted.
  Replacing the above code with :</p>
  
  <pre><code>$smtp = Net::SMTP-&gt;new("$mailserver",
                          Hello =&gt; "$localhostname",
                          Timeout =&gt; 60,
                          Port =&gt; "$port",  //Port value is 465
                          Debug =&gt; 1);
  $smtp-&gt;auth($username, $password);
  </code></pre>
  
  <p>...Remaining script which sets sender, receiver body etc</p>
  
  <p>This fails. The debug logs look like this:</p>
  
  <pre class="lang-none prettyprint-override"><code>Net::SMTP&gt;&gt;&gt; Net::SMTP(3.11)
  Net::SMTP&gt;&gt;&gt;   Net::Cmd(3.11)
  Net::SMTP&gt;&gt;&gt;     Exporter(5.73)
  Net::SMTP&gt;&gt;&gt;   IO::Socket::INET(1.39)
  Net::SMTP&gt;&gt;&gt;     IO::Socket(1.39)
  Net::SMTP&gt;&gt;&gt;       IO::Handle(1.39)
  Net::SMTP: Net::Cmd::getline(): unexpected EOF on command channel:  at fescommon/mailsend-new.pl line 67.
  Can't call method "auth" on an undefined value at fescommon/mailsend-new.pl line 74.
  </code></pre>
  
  <p>Note: Modules like Net::SMTP, Net::SMTP::SSL, IO::Socket::SSL and others are all updated to the latest version.</p>
  
  <p>Expected Result is that request on "submissions" service listening on port 465 on SMTP server can be made using latest Net::SMTP module, without using Net::SMTP::SSL (because the document claims)</p>