Re: send emails via perl
[email protected] (Sergio Letuche) Wed, 19 Nov 2014 16:22:09 +0200
| Newsgroups | perl.perl4lib |
|---|---|
| Message-ID | <CANnh_k_P3SeOd7Uz3tLn4krHnhtnhe=vKsDWMu25Y0nfCdPMUA@mail.gmail.com> |
--001a113a993ae09af0050836efbb Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable ok this is what i asked, could a mail be sent without mailx been installed, thank you 2014-11-19 16:19 GMT+02:00 PHILLIPS M.E. <[email protected]>: > Not sure exactly what you mean by not using a mailer. > > > > In our Perl scripts I tend to do: > > > > open (MAIL, "|-", '/bin/mailx', '-s', $subject, @addresses) > > || die "Failed to e-mail report: $!\n"; > > print MAIL $report; > > close MAIL; > > > > which relies on mailx being installed and able to send messages. > > > > I=E2=80=99m sure there are SMTP modules for Perl, and things like that wh= ich could > do it all at socket level, but I wouldn=E2=80=99t see that as being easie= r > necessarily. It depends on what control you have over your server. > > > > Matthew > > > > *From:* Sergio Letuche [mailto:[email protected]] > *Sent:* 19 November 2014 08:31 > *To:* [email protected] > *Subject:* send emails via perl > > > > hello, > > > > we need to use the easiest solution, if possible just use a perl module, > to be able to send automated emails on an Ubuntu server. The scenario is > this: we ran a cron job, and say we would like to send a message after > completion, to a certain for example gmail account. The ideal would be to > not use any mailer, is this possible? Or could you please suggest us the > best - easiest approach? > > > > Thank you > --001a113a993ae09af0050836efbb Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">ok this is what i asked, could a mail be sent without mail= x been installed,<div><br></div><div>thank you</div></div><div class=3D"gma= il_extra"><br><div class=3D"gmail_quote">2014-11-19 16:19 GMT+02:00 PHILLIP= S M.E. <span dir=3D"ltr"><<a href=3D"mailto:[email protected]" t= arget=3D"_blank">[email protected]</a>></span>:<br><blockquote c= lass=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;= padding-left:1ex"> <div lang=3D"EN-GB" link=3D"blue" vlink=3D"purple"> <div> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca= libri","sans-serif";color:#1f497d">Not sure exactly what you= mean by not using a mailer.<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca= libri","sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></spa= n></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca= libri","sans-serif";color:#1f497d">In our Perl scripts I ten= d to do:<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca= libri","sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></spa= n></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca= libri","sans-serif";color:#1f497d">open (MAIL, "|-"= ;, '/bin/mailx', '-s', $subject, @addresses)<u></u><u></u><= /span></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca= libri","sans-serif";color:#1f497d">=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 || die "Failed to e-mail report: $!\n";<u></u>= <u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca= libri","sans-serif";color:#1f497d">print MAIL $report;<u></u= ><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca= libri","sans-serif";color:#1f497d">close MAIL;<u></u><u></u>= </span></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca= libri","sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></spa= n></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca= libri","sans-serif";color:#1f497d">which relies on mailx bei= ng installed and able to send messages.<u></u><u></u></span></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca= libri","sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></spa= n></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca= libri","sans-serif";color:#1f497d">I=E2=80=99m sure there ar= e SMTP modules for Perl, and things like that which could do it all at sock= et level, but I wouldn=E2=80=99t see that as being easier necessarily.=C2= =A0 It depends on what control you have over your server.<u></u><u></u></span>= </p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca= libri","sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></spa= n></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca= libri","sans-serif";color:#1f497d">Matthew<u></u><u></u></sp= an></p> <p class=3D"MsoNormal"><span style=3D"font-size:11.0pt;font-family:"Ca= libri","sans-serif";color:#1f497d"><u></u>=C2=A0<u></u></spa= n></p> <div style=3D"border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm = 4.0pt"> <div> <div style=3D"border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0cm = 0cm 0cm"> <p class=3D"MsoNormal"><b><span lang=3D"EN-US" style=3D"font-size:10.0pt;fo= nt-family:"Tahoma","sans-serif"">From:</span></b><span = lang=3D"EN-US" style=3D"font-size:10.0pt;font-family:"Tahoma",&qu= ot;sans-serif""> Sergio Letuche [mailto:<a href=3D"mailto:code4libuser= [email protected]" target=3D"_blank">[email protected]</a>] <br> <b>Sent:</b> 19 November 2014 08:31<br> <b>To:</b> <a href=3D"mailto:[email protected]" target=3D"_blank">perl4lib@= perl.org</a><br> <b>Subject:</b> send emails via perl<u></u><u></u></span></p> </div> </div><span class=3D""> <p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p> <div> <p class=3D"MsoNormal">hello,<u></u><u></u></p> <div> <p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p> </div> <div> <p class=3D"MsoNormal">we need to use the easiest solution, if possible jus= t use a perl module, to be able to send automated emails on an Ubuntu serve= r. The scenario is this: we ran a cron job, and say we would like to send a= message after completion, to a certain for example gmail account. The ideal would be to not use any mailer, is th= is possible? Or could you please suggest us the best - easiest approach?<u>= </u><u></u></p> </div> <div> <p class=3D"MsoNormal"><u></u>=C2=A0<u></u></p> </div> <div> <p class=3D"MsoNormal">Thank you<u></u><u></u></p> </div> </div> </span></div> </div> </div> </blockquote></div><br></div> --001a113a993ae09af0050836efbb--