<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.johnlradford.io/index.php?action=history&amp;feed=atom&amp;title=Sending_an_Email_with_Perl_via_Sendmail</id>
	<title>Sending an Email with Perl via Sendmail - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.johnlradford.io/index.php?action=history&amp;feed=atom&amp;title=Sending_an_Email_with_Perl_via_Sendmail"/>
	<link rel="alternate" type="text/html" href="https://wiki.johnlradford.io/index.php?title=Sending_an_Email_with_Perl_via_Sendmail&amp;action=history"/>
	<updated>2026-05-05T15:12:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.johnlradford.io/index.php?title=Sending_an_Email_with_Perl_via_Sendmail&amp;diff=21&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;If your system has a &lt;code&gt;sendmail&lt;/code&gt; compatible MTA installed you can use it in conjunction with the Perl script below to send an Email using Perl.  &lt;pre&gt; #!/usr/bin/env perl   $to = &#039;to@example.com&#039;; $from = &#039;from@example.com&#039;; $subject = &#039;Sent with Perl and Sendmail&#039;; $message = &#039;This is test email sent using Perl and Sendmail.&#039;;   open(MAIL, &quot;|/usr/sbin/sendmail -t&quot;);   # Email Header print MAIL &quot;To: $to\n&quot;; print MAIL &quot;From: $from\n&quot;; print MAIL &quot;Subject: $subj...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.johnlradford.io/index.php?title=Sending_an_Email_with_Perl_via_Sendmail&amp;diff=21&amp;oldid=prev"/>
		<updated>2023-10-04T11:53:39Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;If your system has a &amp;lt;code&amp;gt;sendmail&amp;lt;/code&amp;gt; compatible MTA installed you can use it in conjunction with the Perl script below to send an Email using Perl.  &amp;lt;pre&amp;gt; #!/usr/bin/env perl   $to = &amp;#039;to@example.com&amp;#039;; $from = &amp;#039;from@example.com&amp;#039;; $subject = &amp;#039;Sent with Perl and Sendmail&amp;#039;; $message = &amp;#039;This is test email sent using Perl and Sendmail.&amp;#039;;   open(MAIL, &amp;quot;|/usr/sbin/sendmail -t&amp;quot;);   # Email Header print MAIL &amp;quot;To: $to\n&amp;quot;; print MAIL &amp;quot;From: $from\n&amp;quot;; print MAIL &amp;quot;Subject: $subj...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;If your system has a &amp;lt;code&amp;gt;sendmail&amp;lt;/code&amp;gt; compatible MTA installed you can use it in conjunction with the Perl script below to send an Email using Perl.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/usr/bin/env perl&lt;br /&gt;
 &lt;br /&gt;
$to = &amp;#039;to@example.com&amp;#039;;&lt;br /&gt;
$from = &amp;#039;from@example.com&amp;#039;;&lt;br /&gt;
$subject = &amp;#039;Sent with Perl and Sendmail&amp;#039;;&lt;br /&gt;
$message = &amp;#039;This is test email sent using Perl and Sendmail.&amp;#039;;&lt;br /&gt;
 &lt;br /&gt;
open(MAIL, &amp;quot;|/usr/sbin/sendmail -t&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
# Email Header&lt;br /&gt;
print MAIL &amp;quot;To: $to\n&amp;quot;;&lt;br /&gt;
print MAIL &amp;quot;From: $from\n&amp;quot;;&lt;br /&gt;
print MAIL &amp;quot;Subject: $subject\n\n&amp;quot;;&lt;br /&gt;
# Email Body&lt;br /&gt;
print MAIL $message;&lt;br /&gt;
&lt;br /&gt;
close(MAIL);&lt;br /&gt;
print &amp;quot;Email Sent!\n&amp;quot;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, you can just fopen the sendmail program as if it were a file and print to it the same way you&amp;#039;d print to a file, then close it the same way you&amp;#039;d close a file to send.&lt;br /&gt;
&lt;br /&gt;
[[Category: Sending an Email with...]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
	</entry>
</feed>