Net::DNS::Sendmail(3) User Contributed Perl DocumentationNet::DNS::Sendmail(3) NAME Net::DNS::Sendmail - Simple Mail Transfer Mail Client with MX lookup. Which will basically act as a primitive sendmail MTA. SYNOPSIS use Net::DNS::Sendmail; # Constructors $smtp = Net::DNS::Sendmail->new(); $smtp->to("john\@gmail.com, mary\@yahoo.com, goliath\@hotmail.com"); $smtp->from("srikanth\@cpan.org"); $smtp->subject("This is the subject line."); $smtp->data("This allows for sending single or multiple emails\n " . directly to sendmail servers."); $smtp->data(" This program runs directly on the public domain just like"); $smtp->data(" sendmail."); $smtp->sendmail(); DESCRIPTION This module implements a client interface to the SMTP and EMSMTP ( as mentioned in RFC821 and RFC2821) servers which allow you to use it as a SMTP/ESMTP client. This module connects directly to Yahoo/Hot- mail/Gmail servers and delivers the mail without the need for interme- diate Mail Transfer Agents(MTA) like sendmail(sendmail.org). A new Net::DNS::Sendmail object must be created with the new method. Once this has been done then the to, from, subject and data sections of an email are created with the following methods using the object: Examples: This example sends and email to krishna@bharat.com #!/usr/local/bin/perl -w use Net::DNS::Sendmail; $smtp = Net::DNS::Sendmail->new(); $smtp->to( 'krishna@bharat.com' ); $smtp->from( 'rama@ramayana.com' ); $smtp->subject( "This is the great treaty\n"); $smtp->data("This the story of the great Krishna in Maha Bharat and, "); $smtp->data("Rama in The Ramayana.\n"); $smtp->sendmail(); This example sends emails to both krishna@bharat.com and rama@ramayana.com. #!/usr/local/bin/perl -w use Net::DNS::Sendmail; $smtp = Net::DNS::Sendmail->new(); $smtp->to('krishna@bharat.com,rama@ramayana.com' ); $smtp->from( 'bhrama@mydomain.com' ); $smtp->senderdomain( 'bhrama@mydomain.com' ); $smtp->subject( "This is the great treaty\n"); $smtp->data("This the story of the great Krishna in Maha Bharat and, "); $smtp->data("Rama in The Ramayana.\n"); $smtp->sendmail(); METHODS Unless otherwise stated all methods return either a true or false value, with true meaning that the operation was a success. When a method states that it returns a value, failure will be returned as undef or an empty list. to( ) This sets the remote email to whom to deliver the message to and the is replaced with the destination email address or addresses. If more than one email address needs to be given, please seperate them with a comma. Note: When using single quote do not escape the @ symbol. from( ) This sets the from whom the message is being sent from. Only one email address should be specified here. subject( ) This sets the subject of the email message that is being sent. data( ) This sets the email message content that is being sent to the receiver. sendmail() This finally sends the email to the mentioned email address or addresses after all the above to(), from(), subject() and data() methods have been called. senderdomain( ) This sets the domain for EHLO commands for some of the SMPT/ESMPT servers which check whether the from address domain is the same as the domain the email is being is sent from for SPAM protection reasons. Replace with the domain name from where this program is being run from. eg. $smtp->senderdomain('yahoo.com') verbose(); If this method is called before the all of the above methods, the verbose information is printed to STDOUT. INSTALLATION To install this module type the following: perl Makefile.PL make make test make install DEPENDENCIES This module requires these other modules and libraries: IO::Socket Net::DNS MAILINGLIST: http://www.coreunix.com/corebb/index.php http://www.coreunix.com/opensource/sendmail AUTHOR Srikanth Penumetcha, COPYRIGHT AND LICENSE Copyright (C) 2005 by Srikanth Penumetcha This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available. perl v5.8.7 2005-10-23 Net::DNS::Sendmail(3)