Here you are.
1. Start sendmail service
1 | /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.
1 | /etc/resolv .conf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 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