Here you are.
1. Start sendmail service
/etc/rc.d/init.d/sendmail start
2. Configure proper DNS server to ensure that the domain name of target email address can be resolved.
/etc/resolv.conf3. This is a sample function for send mail
create or replace function sendmail() returns integer as ' #!/usr/bin/perl use Net::SMTP; my ($sendTo,$sendFrom, $Subject, $Message)=(''openkbinfo@gmail.com'',''gpadmin@mdw.com'', ''Hello from OpenKB'',''Hello:)''); my $smtp=Net::SMTP->new("localhost"); $smtp->mail($sendFrom); $smtp->recipient($sendTo); $smtp->data(); $smtp->datasend("To: $sendTo\n"); $smtp->datasend("Subject: $Subject\n"); $smtp->datasend("Content-Type: text/plain;\n\n"); $smtp->datasend("$Message\n"); $smtp->dataend(); $smtp->quit(); return 1; ' language 'plperlu'; openkb=# select sendmail(); sendmail ---------- 1 (1 row)
No comments:
Post a Comment