- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: sendmail program
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2003 11:52 AM
тАО04-17-2003 11:52 AM
sendmail program
It should take the following as command line arguments :
a. recepient's address
b. subject
c. mail text
d. filename - optional (as attachment)
any help will be appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2003 11:54 AM
тАО04-17-2003 11:54 AM
Re: sendmail program
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2003 11:59 AM
тАО04-17-2003 11:59 AM
Re: sendmail program
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2003 12:08 PM
тАО04-17-2003 12:08 PM
Re: sendmail program
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2003 12:24 PM
тАО04-17-2003 12:24 PM
Re: sendmail program
I had to use this as cgi for web messaging.
I know of a Java program which uses a nice interface and implements SMTP too.
Let me know what will do.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-17-2003 12:32 PM
тАО04-17-2003 12:32 PM
Re: sendmail program
If you have code for the perl or cgi program, can you forward it to me pl.
abhay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-18-2003 06:06 AM
тАО04-18-2003 06:06 AM
Re: sendmail program
---------------------------
sub sendmail {
my $rh_Stuff = $_[0];
my $rc = 1;
my ($iaddr, $paddr, $proto, $a, $i);
my $Subject = $$rh_Stuff{'Subject'} || "Default Subject";
my $From = $$rh_Stuff{'From'} || "$$rh_Stuff{'DefaultFrom'}";
my $Server = $$rh_Stuff{'Server'} || "
my $RetAddr = $From;
if ($$rh_Stuff{'RealName'}) {
$RetAddr = '"'.$$rh_Stuff{'RealName'}.'"'." <$From>";
}
$rc = &error("No recipient!") unless $$rh_Stuff{'To'};
my @TO = split(/,\s*/,$$rh_Stuff{'To'});
$Port = $$rh_Stuff{'Port'};
$Port ||= 25;
$Port = getservbyname($Port,'tcp') if $Port =~ /\D/;
$rc = &error("Port not valid.") unless $Port;
$iaddr = inet_aton($Server);
$rc = &error("Can not resolve hostname $Server") unless $iaddr;
$paddr = sockaddr_in($Port, $iaddr);
$proto = getprotobyname('tcp');
my $ipstring = inet_ntoa((unpack_sockaddr_in($paddr))[1]);
socket(S, PF_INET, SOCK_STREAM, $proto) || &error("socket call failed: $!");
connect(S, $paddr) || &error("Unable to connect to $ipstring on port $port: $! (possibly no route to host or connection refused by host)");
select(S); $| = 1; select(STDOUT);
&PrintHTMLWeb("Connection made to $$rh_Stuff{'Server'}:$Port\n") if $SHOW_SMTP_DEBUG;
# session is initiated
$a = &ReadMultiLineSMTP();
$rc = &error("SMTP error: $a") if $a !~ /^2/;
&WriteSocket("HELO localhost$CRLF");
$a = &ReadMultiLineSMTP();
$rc = &error("SMTP error: $a") if $a !~ /^2/;
&WriteSocket("MAIL FROM:$From$CRLF");
$a = &ReadMultiLineSMTP();
$rc = &error("SMTP error: $a") if $a !~ /^2/;
foreach $i(@TO) {
&WriteSocket("RCPT TO:<$i>$CRLF");
$a = &ReadMultiLineSMTP();
$rc = &error("SMTP error: $a") if $a !~ /^2/;
}
# send message body
&WriteSocket("DATA$CRLF");
$a = &ReadMultiLineSMTP();
$rc = &error("SMTP error: $a") if $a !~ /^3/;
&WriteSocket("From: $RetAddr$CRLF");
&WriteSocket("To: $TO[0]");
for ($i = 1; $i < @TO; $i++) {
&WriteSocket(",$TO[$i]");
}
&WriteSocket("$CRLF");
&WriteSocket("Subject: $Subject$CRLF");
&WriteSocket("Reply-To: $From$CRLF");
&WriteSocket("X-Mailer: Your Mailer$CRLF");
&WriteSocket("X-Referer: $ENV{'REMOTE_HOST'}$CRLF");
&WriteSocket("$CRLF");
&WriteSocket("$$rh_Stuff{'Message'}$CRLF");
&WriteSocket("$CRLF.$CRLF");
$a = &ReadMultiLineSMTP();
&WriteSocket("QUIT$CRLF");
return $rc;
}
-----------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-18-2003 06:09 AM
тАО04-18-2003 06:09 AM
Re: sendmail program
Here's how you call it.
----------------------------
&sendmail( { 'DefaultFrom' => "$DefaultFrom",
'Server' => "$MailServer",
'From' => "$Data{'From'}",
'RealName' => "$Data{'RealName'}",
'To' => "$To",
'Subject' => "$Data{'Subject'}",
'Message' => "$TEXT",
}
);
---------------------------
I am assuming that you are taking your mail document and storing the data in a hash_table.
something like $Data{'To'} stores the to address and subject and so on..
Let me know if you need something else