dbTalk Databases Forums  

Retrieve the whole Hostname / Problem with Package utl_smtp

comp.databases.oracle.server comp.databases.oracle.server


Discuss Retrieve the whole Hostname / Problem with Package utl_smtp in the comp.databases.oracle.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
BKochs
 
Posts: n/a

Default Retrieve the whole Hostname / Problem with Package utl_smtp - 10-13-2004 , 07:29 AM






Hello everyone,

UTL_INADDR.get_host_name()
will get the Host: MYHOST

but will not get the whole hostname
MYHOST.MYDOMAIN.COM

I use a W2K client.
__________________________________________________ _____________________
I guess the mailhost is the mailserver in the
utl_smtp.open_connection( -function.
But in the example here it's the same host with utl_smtp.helo(.

In my script (you don't see here) the helo-mailhost must get the
hostname of the clientmachine,the full hostname for
example:MYHOST.MYDOMAIN.COM
UTL_INADDR.get_host_name() will only retrieve MYHOST an this is my
problem.
The script / procedure will be executet on different machines.

Greetings Bern Kochs

EXAMPLE:
PROCEDURE send_mail (sender IN VARCHAR2,
recipient IN VARCHAR2,
message IN VARCHAR2)
IS
mailhost VARCHAR2(30) := 'mailhost.mydomain.com';
mail_conn utl_smtp.connection;
BEGIN
mail_conn := utl_smtp.open_connection(mailhost, 25);
utl_smtp.helo(mail_conn, mailhost);
utl_smtp.mail(mail_conn, sender);
utl_smtp.rcpt(mail_conn, recipient);
utl_smtp.data(mail_conn, message);
utl_smtp.quit(mail_conn);
EXCEPTION
WHEN OTHERS THEN
-- Handle the error
END;

Reply With Quote
  #2  
Old   
Daniel Morgan
 
Posts: n/a

Default Re: Retrieve the whole Hostname / Problem with Package utl_smtp - 10-13-2004 , 09:39 PM






BKochs wrote:

Quote:
Hello everyone,

UTL_INADDR.get_host_name()
will get the Host: MYHOST

but will not get the whole hostname
MYHOST.MYDOMAIN.COM

I use a W2K client.
__________________________________________________ _____________________
I guess the mailhost is the mailserver in the
utl_smtp.open_connection( -function.
But in the example here it's the same host with utl_smtp.helo(.

In my script (you don't see here) the helo-mailhost must get the
hostname of the clientmachine,the full hostname for
example:MYHOST.MYDOMAIN.COM
UTL_INADDR.get_host_name() will only retrieve MYHOST an this is my
problem.
The script / procedure will be executet on different machines.

Greetings Bern Kochs

EXAMPLE:
PROCEDURE send_mail (sender IN VARCHAR2,
recipient IN VARCHAR2,
message IN VARCHAR2)
IS
mailhost VARCHAR2(30) := 'mailhost.mydomain.com';
mail_conn utl_smtp.connection;
BEGIN
mail_conn := utl_smtp.open_connection(mailhost, 25);
utl_smtp.helo(mail_conn, mailhost);
utl_smtp.mail(mail_conn, sender);
utl_smtp.rcpt(mail_conn, recipient);
utl_smtp.data(mail_conn, message);
utl_smtp.quit(mail_conn);
EXCEPTION
WHEN OTHERS THEN
-- Handle the error
END;
How about getting the IP address instead?

A demo of that capability with UTL_INADDR is available to www.psoug.org
click on Morgan's Library
click on UTL_INADDR
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)



Reply With Quote
  #3  
Old   
BKochs
 
Posts: n/a

Default Re: Retrieve the whole Hostname / Problem with Package utl_smtp - 10-14-2004 , 04:00 AM



The Problem is, that the HELO command needs the full qualified domain
name:
MYHOST.MYDOMAIN.COM

Given the IP-Address instead of the full q.d.n it will return the
message:
can't verify that you are 100.200.300.400 .
And there is not Problem getting the IP-Address using :
get_host_address

The same message you will get with MYHOST.
Only if you submit MYHOST.MYDOMAIN.COM you will get a message like
G'day ...

Maybe it depends upon how the smtp server is set up.
Fakt is that UTL_INADDR.get_host_name() will not retrieve the full
qualified hostname.

But the Oracle Package depends on Java-Code and there ist a Class,
maybe there methods not beeing published yet in a appropiate oracle
package:
oracle.plsql.net.InternetAddress

I will have a look a this.

Greetings bernd kochs

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.