<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:inherit;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML con formato previo Car";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EstiloCorreo17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.HTMLconformatoprevioCar
        {mso-style-name:"HTML con formato previo Car";
        mso-style-priority:99;
        mso-style-link:"HTML con formato previo";
        font-family:"Courier New";
        mso-fareast-language:ES-NI;}
span.apple-converted-space
        {mso-style-name:apple-converted-space;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ES-NI" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:14.0pt;font-family:"Arial",sans-serif">Good Afternoon,
<br>
<span style="color:#212121;background:white">I modified the Email.pm file to send mail through an account in gmail .<o:p></o:p></span></span></p>
<p class="MsoNormal" style="background:white"><span lang="EN" style="font-size:14.0pt;font-family:"Arial",sans-serif;color:#212121;mso-fareast-language:ES-NI">The modified code is as follows:<o:p></o:p></span></p>
<p class="MsoNormal" style="background:white"><span lang="EN" style="font-size:14.0pt;font-family:"Arial",sans-serif;color:#212121;mso-fareast-language:ES-NI"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#333333;background:white">sub send_mail_via_smtp</span><span lang="EN-US" style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#333333"><br>
<span style="background:white">{</span><br>
<span style="background:white"> my( %p ) = @_;</span><br>
<br>
<span style="background:white"> eval 'use Net::SMTP::TLS';</span><br>
<br>
<span style="background:white"> my $repository = $p{session}->get_repository;</span><br>
<br>
<span style="background:white"> my $smtphost = $repository->get_conf( 'smtp_server' );</span><br>
<span style="background:white"> ##my $smtphost = 'smtp.gmail.com';</span><br>
<br>
<span style="background:white"> if( !defined $smtphost )</span><br>
<span style="background:white"> {</span><br>
<span style="background:white"> $repository->log( "No STMP host has been defined. To fix this, find the full\naddress of your SMTP server (eg. smtp.example.com) and add it\nas the value of smtp_server in\nperl_lib/EPrints/SystemSettings.pm" );</span><br>
<span style="background:white"> return( 0 );</span><br>
<span style="background:white"> }</span><br>
<br>
<br>
<span style="background:white"> my $smtp = new Net::SMTP::TLS (</span><br>
<span style="background:white"> $smtphost,</span><br>
<span style="background:white"> Hello => 'eprints-server.on-linux.org',</span><br>
<span style="background:white"> Port => 587,</span><br>
<span style="background:white"> User => 'eprints-server@gmail.com',</span><br>
<span style="background:white"> Password=> 'gmail_password',</span><br>
<span style="background:white"> );</span><br>
<br>
<span style="background:white"> # my $smtp = Net::SMTP->new( $smtphost);</span><br>
<br>
<span style="background:white"> if( !defined $smtp )</span><br>
<span style="background:white"> {</span><br>
<span style="background:white"> $repository->log( "Failed to create smtp connection to $smtphost" );</span><br>
<span style="background:white"> return( 0 );</span><br>
<span style="background:white"> }</span><br>
<br>
<span style="background:white"> $smtp->mail( $p{from_email} );</span><br>
<span style="background:white"> $smtp->to( $p{to_email} );</span><br>
<span style="background:white"> <span class="apple-converted-space"> </span></span><br>
<span style="background:white"> # if( !$smtp->recipient( $p{to_email} ) ) <span class="apple-converted-space"> </span></span><br>
<span style="background:white"> # {</span><br>
<span style="background:white"> # $repository->log( "smtp server refused <$p{to_email}>" );</span><br>
<span style="background:white"> # $smtp->quit;</span><br>
<span style="background:white"> # return 0;</span><br>
<span style="background:white"> # }</span><br>
<br>
<span style="background:white"> my $message = build_email( %p );</span><br>
<span style="background:white"> my $data = $message->as_string;</span><br>
<span style="background:white"> # Send the message as bytes, to avoid Net::Cmd wide-character warnings</span><br>
<span style="background:white"> utf8::encode($data);</span><br>
<span style="background:white"> $smtp->data;</span><br>
<span style="background:white"> $smtp->datasend( $data );</span><br>
<span style="background:white"> $smtp->dataend;</span><br>
<span style="background:white"> $smtp->quit;</span><br>
<br>
<span style="background:white"> return 1;</span><br>
<span style="background:white">}<o:p></o:p></span></span></p>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#333333;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:10.5pt;font-family:"Arial",sans-serif;color:#333333;background:white"><o:p> </o:p></span></p>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-family:"Arial",sans-serif;color:#333333;background:white"><o:p> </o:p></span></p>
<pre style="background:white"><span lang="EN" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:#212121">But when sending mail, displays the following error:</span><span lang="EN-US" style="font-size:11.0pt;font-family:"Arial",sans-serif;color:#212121"><o:p></o:p></span></pre>
<pre><span lang="EN-US" style="color:black">Can't locate object method "new" via package "Net::SMTP::TLS" (perhaps you forgot to load "Net::SMTP::TLS"?) at /usr/share/eprints3/perl_lib/EPrints/Email.pm line 163.<o:p></o:p></span></pre>
<pre><span lang="EN-US" style="color:black"><o:p> </o:p></span></pre>
<pre style="background:white"><span lang="EN" style="font-family:"Arial",sans-serif;color:#212121">How do I correct this error ?<o:p></o:p></span></pre>
<pre style="background:white"><span lang="EN" style="font-family:"Arial",sans-serif;color:#212121"><o:p> </o:p></span></pre>
<pre style="background:white"><span lang="EN" style="font-family:"inherit",serif;color:#212121">How do I get to send mail through an account in gmail ?</span><span lang="EN-US" style="font-family:"inherit",serif;color:#212121"><o:p></o:p></span></pre>
<pre style="background:white"><span lang="EN-US" style="font-family:"Arial",sans-serif;color:#212121"><o:p> </o:p></span></pre>
<pre style="background:white"><span lang="EN-US" style="font-family:"Arial",sans-serif;color:#212121"><o:p> </o:p></span></pre>
<pre style="background:white"><span lang="EN" style="font-family:"inherit",serif;color:#212121">Thank you</span><span style="font-family:"inherit",serif;color:#212121"><o:p></o:p></span></pre>
<pre style="background:white"><span lang="EN-US" style="font-family:"Arial",sans-serif;color:#212121"><o:p> </o:p></span></pre>
<pre style="background:white"><span lang="EN-US" style="font-family:"Arial",sans-serif;color:#212121"><o:p> </o:p></span></pre>
<pre><span lang="EN-US" style="color:black"><o:p> </o:p></span></pre>
<p class="MsoNormal" style="background:white"><span lang="EN-US" style="font-size:14.0pt;font-family:"Arial",sans-serif;color:#212121;mso-fareast-language:ES-NI"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
</div>
</body>
</html>