SolMan: SLDCHECK = 500 Command unrecognized
Hello!
After upgrade SolMan system 7.0 to EHP1
SLDCHECK run with error
http://<host>:<port>/sld
220 hometst2.homecredit.ru SAP 7.00(52) ESMTP service ready
500 Command unrecognized
500 Command unrecognized
500 Command unrecognized
500 Command unrecognized
500 Command unrecognized
500 Command unrecognized
500 Command unrecognized
500 Command unrecognized
500 Command unrecognized
500 Command unrecognized
Thank you!
Regards,
Tonya
Hi Antonina,
I've encountered the same error while configuring solman initial setup in J2EE Configuration.
May I ask how did you find the correct port? May I know the details, please?
Thanks in advance,
Chonalyn
Similar Messages
-
Cmd command unrecognized in windows 8 command prompt
I'm trying to create a txt file via command line on windows 8 using the following command in the root directory (C:):
echo getmac for laptop > c:\data\laptop_mac.txt"
cmd /c "getmac >> c:\data\laptop_mac.txt"
The fist line works but the command prompt tells me following with the cmd command: 'cmd' is not recognized as an internal or external command, operable program or batch file.
As a result the file does get created but it doesn't get my mac address like it should. I should point out that the exact same commands works under windows 7 enterprise. I used the sfc/scannow command to check for corrupt files and it did find some files.
I would attach the log if I knew how to attach one. The file is very long and I don't want to post it directly in here because of that.
Also, I did run this in administrator and windows 8 is updated. Finally, I noticed that the cmd command works in the system32 folder but I really don't think I should create a txt file there.The reason I have 3 quotation marks is because that's what my instructor wrote. What confuses the living heck out of me is the fact that the exact same command with the quotation marks works just fine in windows 7 enterprise. I'm having a hard time understand
why it doesn't work in windows 8.
We have seen discrepancies involving Enterprise versions before. See if the cmd help could explain them:
cmd /?
<extract OS="W8.1 Pro">
If /C or /K is specified, then the remainder of the command line after
the switch is processed as a command line, where the following logic is
used to process quote (") characters:
1. If all of the following conditions are met, then quote characters
on the command line are preserved:
- no /S switch
- exactly two quote characters
- no special characters between the two quote characters,
where special is one of: &<>()@^|
- there are one or more whitespace characters between the
two quote characters
- the string between the two quote characters is the name
of an executable file.
2. Otherwise, old behavior is to see if the first character is
a quote character and if so, strip the leading character and
remove the last quote character on the command line, preserving
any text after the last quote character.
</extract>
I guess that might cover my escaped double-quote requirement?
Btw I tried:
cmd /c getmac >> pcmac.txt
and it failed.
What was the symptom exactly and where were you when you tried this (directory-wise)? E.g. Now I'm wondering where that cmd.exe would be running (therefore writing). If it is at the root or somewhere else protected you might be seeing a permissions
problem that way. I would try running ProcMon to check on that possibility, as well as clarify exactly what that cmd.exe is doing.
Good luck
Robert
Robert Aldwinckle -
Sending an email from a servlet
Hi Guys,
Im trying to send an email from a servlet. I am using the following code:
IMPORTING LIBRARIES
import java.util.*;
import java.io.*;
import javax.servlet.http.*;
import javax.servlet.*;
//importing JDBC
import java.sql.*;
//email
import java.net.*;
import java.text.*; // Used for date formatting.
BEGIN CLASS
public class Email3 extends HttpServlet
private Socket smtpSocket = null;
private DataOutputStream os = null;
private DataInputStream is = null;
public void doPost (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
PrintWriter out = res.getWriter();
OUTPUT TAGS FOR WEBPAGE
out.println("<html>");
out.println("<head>");
out.println("<title>FYP</title>");
out.println("</head>");
out.println("<body>");
out.println("<center>");
send email
//Date dDate = new Date();
//DateFormat dFormat = _
//DateFormat.getDateInstance(DateFormat.FULL,Locale.US);
String m_sHostName="localhost";
int m_iPort=25;
try
{ // Open port to server
smtpSocket = new Socket(m_sHostName, m_iPort);
os = new DataOutputStream(smtpSocket.getOutputStream());
is = new DataInputStream(smtpSocket.getInputStream());
if(smtpSocket != null && os != null && is != null)
{ // Connection was made. Socket is ready for use.
out.println("Connection was made. Socket is ready for use.");
//[ Code to send email will be placed in here. ]
try
{ os.writeBytes("HELLO\r\n");
// You will add the email address that the server
// you are using know you as.
os.writeBytes("MAIL From: <[email protected]>\r\n");
// Who the email is going to.
os.writeBytes("RCPT To: <[email protected]>\r\n");
//IF you want to send a CC then you will have to add this
os.writeBytes("RCPT Cc: <[email protected]>\r\n");
// Now we are ready to add the message and the
// header of the email to be sent out.
os.writeBytes("DATA\r\n");
os.writeBytes("X-Mailer: Via Java\r\n");
//os.writeBytes("DATE: " + dFormat.format(dDate) + "\r\n");
os.writeBytes("From: Me <[email protected]>\r\n");
os.writeBytes("To: YOU <[email protected]>\r\n");
//Again if you want to send a CC then add this.
os.writeBytes("Cc: CCDUDE <[email protected]>\r\n");
//Here you can now add a BCC to the message as well
//os.writeBytes("RCPT Bcc: BCCDude<[email protected]>\r\n");
String sMessage = "Your subjectline.";
os.writeBytes("Subject: Your subjectline here\r\n");
os.writeBytes(sMessage + "\r\n");
os.writeBytes("\r\n.\r\n");
os.writeBytes("QUIT\r\n");
// Now send the email off and check the server reply.
// Was an OK is reached you are complete.
String responseline;
while((responseline = is.readLine())!=null)
{ // System.out.println(responseline);
out.println("responseline= "+responseline+"<br>");
if(responseline.indexOf("Ok") != -1)
//out.println("responseline"+responseline);
break;
catch(Exception e)
{ System.out.println("Cannot send email as an error occurred.");
out.println("Cannot send email as an error occurred.");
catch(Exception e)
{ System.out.println("Host " + m_sHostName + "unknown"); }
out.println("</center>");
out.println("</body>");
out.println("</html>");
out.close();
}//end class
it compiles fine, the connection was made ok but im not receiving the email. When the email is sent off the server reply does not seem to be Ok, as the print statement i tried there is not being executed. When i print the content of my responseline= variable before the if statement i get the following:
Connection was made. Socket is ready for use. responseline= 220 centaur.elec.qmul.ac.uk ESMTP Exim 3.16 #2 Thu, 09 Jan 2003 15:54:34 +0000
responseline= 500 Command unrecognized
responseline= 250 is syntactically correct
responseline= 550 relaying to prohibited by administrator
responseline= 500 Command unrecognized
responseline= 503 No recipient(s).
responseline= 500 Command unrecognized
responseline= 500 Command unrecognized
responseline= 500 Command unrecognized
responseline= 500 Command unrecognized
responseline= 500 Command unrecognized
responseline= 500 Command unrecognized
responseline= 500 Command unrecognized
responseline= 500 Command unrecognized
responseline= 221 Closing connection. Good bye.
Can anyone help?
Is there an easier way to send an email from a servlet?
Thanks
tzafIt's not a matter of "easier way" to send mail from servlet...you are missing a crucial element in your code: authorization to send mail. You need something like this (some of which you have already so note what is different):
Properties properties = new Properties();
properties.put("mail.smtp.host", String3 );
properties.put("mail.smtp.dsn.notify", "SUCCESS" );
properties.put("mail.smtp.host", "mailservernamegoeshere");
properties.put("mail.smtp.auth", "true");
MyAuthenticator auth = new MyAuthenticator();
auth.setUser("user whos account you want to use goes here");
auth.setPassword("user password goes here");
Session session = Session.getDefaultInstance( properties,auth );Here is the auth class:
class MyAuthenticator extends Authenticator {
protected String m_strUser = null;
protected String m_strPassword = null;
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(m_strUser,m_strPassword);
public void setUser(String strUser) {
m_strUser = strUser;
public void setPassword(String strPassword) {
m_strPassword = strPassword; -
Hi,
I'am using HAP_DOCUMENT BSP's for Appraisal.It is working fine all these days, now it is giving me this error "220 Host Name.com SAP7.0(52) ESMTP service ready 500 Command unrecognized"
Please guide me with a solution for this issue.
With Regards,
PraveenDear Friends ,
I had a similar error and had to rename the trainingtype.htm to trainingstype.htm. Aparently the uRL is calling the page with the wrong htm. Please proceed as below:
The bsp application is calling trainingstype.htm instead of trainingtype.htm.
A workaround is to use transaction <b>se80</b>. Select <b>BSP Application</b> and search for HCM_LEARINING . Expand the <b>Pages with Flow Logic</b> folder. Right mouse click on <b>trainingtype.htm</b> and rename to trainingstype.htm. You will need to register the object and provide access code. Activate the page after renaming.
Regards,
Ndegwa. -
Hi
My exchange environment consist with "Server Exchange 2010 SP3" and "Edge Server with Exchange 2010 SP3".
On Edge server in SMTP receive log i get every now and then an entry: xxxxxx 500 5.3.3 Unrecognized command.
It is serius problem because I got few e-mails from senders that they had problem with sending e-mail messages to our e-mail domain. They receive e-mail report, for example
Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the server for the recipient domain domena.plby
mail.domena.pl.
[95.xxx.xxx.xx].
The error that the other server returned was:
500 5.3.3 Unrecognized command
Could you help me to solve this problem? What could cause this problem?
Thank you in advance
Tomasz
Kind Regards TomaszI have the same issue, but there is plenty of hard disk storage on the Exchange Server. This seems to only be happening from Google Business account/ Postini. If I send message from my personal Gmail account it works fine, but an agency who is on Google
business seems to have issues sending to us and they are delayed, sometimes they get through and other times they just don't.
Results from Mail Acceptance Test:
I enter my internal address and the remote users postini account as the test setup I received two emails from the tool but the end results of the test are:
Error submitting mail
Mail submission failed: Error message: Syntax error, command unrecognized. The server response was: 5.3.3 Unrecognized command.
Google support stated this:
Here are the logs from Postini trying to connect to mydomain.com (IP x.x.x.x) :
1. 2014/08/09 03:26:28 IP:209.85.218.50 SMTP-STLS:OK <null> TLSv1:RC4-SHA Validate:None 2. 2014/08/09 03:26:28 IP:209.85.218.50 SMTP LOG: Sender => FFD:MAIL FROM:<[email protected]>
3. 2014/08/09 03:26:28 IP:209.85.218.50 Fdal:Customer has null root_iid outbound default at org 100000001 4, 2014/08/09 03:26:28 IP:209.85.218.50 SMTP LOG: Sender <= FFD:250 Ok 5. 2014/08/09 03:26:28 IP:209.85.218.50 SMTP LOG: Sender => FFD:RCPT TO:[email protected]>
6. 2014/08/09 03:26:34 IP:209.85.218.50 To:[email protected] SMTP LOG: FFD => mydomain.com (x.x.x.x):Connection established 7. 2014/08/09 03:26:34 IP:209.85.218.50 To:[email protected] SMTP LOG: FFD <= mydomain.com (x.x.x.x):220 server.mydomain.com
ESMTP Service ready 8. 2014/08/09 03:26:34 IP:209.85.218.50 To:[email protected] SMTP LOG: Sender <= FFD:250 Ok 9. 2014/08/09 03:26:35 IP:209.85.218.50 To:[email protected] SMTP LOG: Sender => FFD:968 last bytes of data with dot 10. 2014/08/09 03:28:05
IP:209.85.218.50 To:[email protected] From:[email protected]:1119780 FP:2603ec6d38c69886eb1000e516fb745a0384e50b SMTP:Delivery still in progress after 90 seconds, recording FP 11. 2014/08/09 03:31:17 IP:209.85.218.50 To:[email protected] SMTP
LOG: FFD => mydomain.com (x.x.x.x):failed to send the last period(.) 12. 2014/08/09 03:31:17 IP:209.85.218.50 To:[email protected] oremote:Skipping Archive for Sender because did not deliver message 13. 2014/08/09 03:31:17 IP:209.85.218.50 To:[email protected]
SMTP:451 Remote connection lost - psmtp 14. 2014/08/09 03:31:17 IP:209.85.218.50 To:[email protected] SMTP LOG: Sender <= FFD:451 Remote connection lost - psmtp
As you can see, on line 9, at 03:26:35, we declared to the receiving server what we were about to send. At the line number 10, almost two minutes passed without an authorization (250 OK) from the receiving server. You can see our status being pushed back
at that moment to the receiving mail server: SMTP:Delivery still in progress after 90 seconds. Two more minutes later the connection was simply dropped and so we generated a 400 error message to encourage the sending server to try again later (since no bounce
was given per say from the receiving server, we won't hard-bounce it but defer it).
I hope this will help. you can try to look in the mydomain.com inbound logs and see at that exact time what happened? Unfortunately, our visibility pretty much ends there as we don't have full visibility of your mail environment. You'll need to investigate
within your own environment unfortunately. If you have any more information to share with me, in case it might help me help you, feel free to do so. I'll leave this case opened for now.
Sincerely,
Patricia
Google Enterprise Support -
Nokia Email Service Error : 500: Failure - Unrecog...
After installing teh new upgraded nokia messeging application, i am recieveing error for sending my email.
500: Failure - Unrecognized SSL message, plaintext connection?
can anyone help.
Sachin
Solved!
Go to Solution.Well let's hope something is done... I'm about to uninstall and find something else. 3 days out of action, and I've had enough.
I thought I'd do the upgrade anyway, in case there were more settings which I could look into.... surprise surprise, there's less from what I can see! Among other things, It appears that we no longer have the choice of how we connect e.g. when I'm home or at work I connect through wireless LAN, when I'm out or travelling I use my phone network. This is gone now, so who knows how I'm connecting.
Also you might want to check out the help file, there's a whole bunch of stuff saying feature "x" isn't available unless your an "enterprise user". So perhaps this is a planned issue! We're going out of beta without warning, and now you have to pay to use the service to send emails... If so, a little warning would be nice.
Anyway, That's my conspiracy theory for the day.. -
Firefox remote command in Sun Ray
Hi all,
I'm trying to solve a problem in a Sun Ray environment. Our program has to use firefox remote to launch a new browser window in addition to an already opened browser window.
But it does not work. No new browser window is opened. Here is output from the standalone build of remote.c (from original Netscape remote control source) as a test program.
% ./firefox-remote -remote 'openURL(http://www.sun.com,new-window)'
firefox-remote: warning: expected version 1.1 but found version
5.1 (0xc80049) instead.
firefox-remote: (writing MOZILLALOCK "pid63258@xavsun" to 0xc80049)
firefox-remote: (writing MOZILLACOMMAND "openURL(http://www.sun.com,new-window)" to 0xc80049)
firefox-remote: (server 0xc80049 has accepted MOZILLACOMMAND.)
2147500037firefox-remote: (server sent MOZILLARESPONSE "500 command not parseable" to 0xc80049.)
But it works fine if issuing the following command:
% firefox -remote 'openURL(http://www.sun.com,new-window)'
Also our program and this test program work fine in Sun Blade workstation.
Is there anybody who has experienced this or has some idea what's going on here?
Thanks a lot for your help.
JennyI solved it in kiosk mode adding my locale to the option Locale like this:
es-ES -
PL/SQL Mail Utility :: Binary/Ascii/Cc/Bcc/FileDump
I was working on my mail package and decided it was overtly complicated and
stripped it down to its bare bones. Here is what I came up with. Built on a previous
foundation of anothers work, I expanded the functionality considerably. You will find all
the features I think that you will need regarding a mail routine. There is also a nice
filedump routine included which makes very easy to create flat file dumps that you can
then attach to your emails. There are a few pre-reqs in using this though :
- 9iR2+
- DBA_Directories defined as opposed to utl_file paths
- Java Virtual Machine. Document can be found in Note :105472.1 Setup, Configuration,
and Use of the Java Virtual Machine on metalink.
As always, I welcome feedback and suggestions for improvement.
Barry C
http://www.myoracleportal.com
CREATE OR REPLACE PACKAGE mail_tools
AS
-- SENDMAIL supports variable message length with/without attachments
-- QUERY_SERVER allows you to check the status of a mail server to see if it is running
-- DUMP_FLATFILE allows you to dump flat file data from query submitted
-- Query Server to verify that the server is up and running.
-- Connects, Noop Command is executed, Disconnect.
-- GET_MAIL_ADDRESS is utilized in the SENDMAIL procedure
-- Table 100-3 SMTP Reply Codes
-- Reply Code
-- Meaning
-- 211 System status, or system help reply
-- 214 Help message [Information on how to use the receiver or the meaning of a particular non-standard command; this reply is useful only to the human user]
-- 220 <domain> Service ready
-- 221 <domain> Service closing transmission channel
-- 250 Requested mail action okay, completed
-- 251 User not local; will forward to <forward-path>
-- 252 OK, pending messages for node <node> started. Cannot VRFY user (e.g., info is not local), but will take message for this user and attempt delivery.
-- 253 OK, <messages> pending messages for node <node> started
-- 354 Start mail input; end with <CRLF>.<CRLF>
-- 355 Octet-offset is the transaction offset
-- 421 <domain> Service not available, closing transmission channel (This may be a reply to any command if the service knows it must shut down.)
-- 450 Requested mail action not taken: mailbox unavailable [for example, mailbox busy]
-- 451 Requested action aborted: local error in processing
-- 452 Requested action not taken: insufficient system storage
-- 453 You have no mail.
-- 454 TLS not available due to temporary reason. Encryption required for requested authentication mechanism.
-- 458 Unable to queue messages for node <node>
-- 459 Node <node> not allowed: reason
-- 500 Syntax error, command unrecognized (This may include errors such as command line too long.)
-- 501 Syntax error in parameters or arguments
-- 502 Command not implemented
-- 503 Bad sequence of commands
-- 504 Command parameter not implemented
-- 521 <Machine> does not accept mail.
-- 530 Must issue a STARTTLS command first. Encryption required for requested authentication mechanism.
-- 534 Authentication mechanism is too weak.
-- 538 Encryption required for requested authentication mechanism.
-- 550 Requested action not taken: mailbox unavailable [for , mailbox not found, no access]
-- 551 User not local; please try <forward-path>
-- 552 Requested mail action aborted: exceeded storage allocation
-- 553 Requested action not taken: mailbox name not allowed [for example, mailbox syntax incorrect]
-- 554 Transaction failed
This version allows for a customized seperator value. Using this function will allow you to
perform fixed width flat files by defining '' for no seperator and then RPAD/LPAD your columns as necessary.
Or use whatever seperator you wish to use, pipe, space, zeros, etc.
-- Example : This will generate a flat file which tabbed seperated
-- DECLARE
-- l_rows NUMBER;
-- l_sql VARCHAR2(32000);
-- BEGIN
-- l_sql := '
-- SELECT rpad(hou.NAME,70) udn_desc
-- , rpad(pcak.segment1,6) coid
-- , rpad(pcak.segment2,4) udn
-- FROM hr_all_organization_units hou, hr.pay_cost_allocation_keyflex pcak
-- WHERE TRUNC (SYSDATE) BETWEEN hou.date_from
-- AND NVL (hou.date_to, ''31-DEC-4712'')
-- AND pcak.cost_allocation_keyflex_id = hou.cost_allocation_keyflex_id
-- GROUP BY pcak.segment1, pcak.segment2, hou.NAME
-- ORDER BY 1, 2, 3
-- l_rows :=
-- dump_flatfile
-- (p_query =>
-- , p_dir => 'INTF000_TABLES'
-- , p_filename => 'test.csv'
-- , p_separator => ' ' -- <= tabbed 5 spaces between each column
-- , p_max_linesize => 32000
-- , p_mode => 'w' -- (w)rite mode or (a)ppend mode
-- END;
FUNCTION dump_flatfile (
p_query IN VARCHAR2
, p_dir IN VARCHAR2
, p_filename IN VARCHAR2
, p_separator IN VARCHAR2
, p_headers IN BOOLEAN DEFAULT FALSE
, p_trailing_separator IN BOOLEAN DEFAULT FALSE
, p_max_linesize IN NUMBER DEFAULT 32000
, p_mode IN VARCHAR2 DEFAULT 'w' )
RETURN NUMBER;
FUNCTION get_mail_address (
addr_list IN OUT VARCHAR2 )
RETURN VARCHAR2;
FUNCTION smtp_command (
command IN VARCHAR2
, ok IN VARCHAR2 DEFAULT '250'
, code OUT VARCHAR2
, DEBUG NUMBER DEFAULT 0 )
RETURN BOOLEAN;
FUNCTION query_server (
smtp_server VARCHAR2
, smtp_server_port PLS_INTEGER DEFAULT 25
, DEBUG NUMBER DEFAULT 0 )
RETURN BOOLEAN;
This procedure uses the UTL_TCP package to send an email message.
Up to three file names may be specified as attachments.
Written: Dave Wotton, 14/6/01 (Cambridge UK)
This script comes with no warranty or support. You are free to
modify it as you wish, but please retain an acknowledgement of
my original authorship.
Amended: Dave Wotton, 10/7/01
Now uses the utl_smtp.write_data() method to send the message,
eliminating the 32Kb message size constraint imposed by the
utl_smtp.data() procedure.
Amended: Dave Wotton, 20/7/01
Increased the v_line variable, which holds the file attachment
lines from 400 to 1000 bytes. This is the maximum supported
by RFC2821, The Simple Mail Transfer Protocol specification.
Amended: Dave Wotton, 24/7/01
Now inserts a blank line before each MIME boundary line. Some
mail-clients require this.
Amended: Dave Wotton, 4/10/01
Introduced a 'debug' parameter. Defaults to 0. If set to
non-zero then errors in opening files for attaching are
reported using dbms_output.put_line.
Include code to hand MS Windows style pathnames.
Amended: Barry Chase, 4/29/03
Added Priority to procedure and also X-Mailer ID.
Removed restrictions for email size limitation as well.
Emails are now formatted text messages, meaning you can
write your message in html format.
And finally, changed from using UTL_SMTP to UTL_TCP instead.
Amended: Barry Chase 11/10/2003
Added session timeout of 4 minutes to prevent hanging server connections
Amended: Barry Chase 12/04/2003
Added Date String so that it represents timezone of originating server
p_datestring
Amended: Barry Chase 03/01/2004
Added functionality to support binary attachments and remote attachments.
Its about 98% complete. Not work perfectly yet. Still trying to figure out
encoding to base64 or mime. Have a good start on it though.
04/12/2004
BCHASE :: Binary Support is fully functional now.
09/01/2005
BCHASE :: Modified attachment directories to use DBA_DIRECTORIES instead
of UTL_DIR in the Oracle initialization file.
02/22/2006
BCHASE :: Added variable length message email support (CLOB)
04/21/2006
BCHASE :: Expanded functionality to include Cc and Bcc
Also removed redundant calls from package. The single
mail_files command will handle flat files and binary files such as zip/pdf/etc.
SMTP Server and SMTP Server Port are parameters on the sendmail procedure now
as well.
Refer to http://home.clara.net/dwotton/dba/oracle_smtp.htm for more
details on the original source code.
For information on the enhanced mail_tools package as provided by Barry
Chase, refer to http://www.myoracleportal.com
/* Retrieves local binary file from database server.
* using DBMS_LOB commands and stores into BLOB
* return BLOB
FUNCTION get_local_binary_data (
p_dir IN VARCHAR2
, p_file IN VARCHAR2 )
RETURN BLOB;
/* Supports binary attachments and message of variable length. Uses CLOB.*/
-- DECLARE
-- t_blob BLOB;
-- BEGIN
-- Use the get_local_binary_data to collect your BLOB from the filesystem
-- or just load from a table where your BLOB is stored at, then just pass
-- as t_blob on the binaryfile parameter below. Remember to provide an
-- appropriate filename. Optionally, you can leave filename NULL and pass
-- the binaryfile parameter as EMPTY_BLOB() to send an email without an
-- attachment.
-- t_blob :=
-- mail_tools.get_local_binary_data
-- ( p_dir => 'INTF0047_TABLES'
--, p_file => 'test_file1.csv' );
-- mail_tools.sendmail
-- ( smtp_server => 'your.smtp.server'
-- , smtp_server_port => 25
-- , from_name => 'Email Address of Sender'
-- , to_name => 'list of TO email addresses separated by commas (,)'
-- , cc_name => 'list of CC email addresses separated by commas (,)'
-- , bcc_name => 'list of BCC email addresses separated by commas (,)'
-- , subject => 'Some brief Subject'
-- , MESSAGE => 'Your message goes here. Can include HTML code.'
-- , priority => '1-5 1 being the highest priority and 3 normal priority'
-- , filename => 'your.filename.txt or leave NULL'
-- , binaryfile => 'your blob is passed here otherwise leave as EMPTY_BLOB()
-- , DEBUG => 'Default is DBMS output otherwise pass a 1 to disable );
-- END;
PROCEDURE sendmail (
smtp_server VARCHAR2
, smtp_server_port PLS_INTEGER DEFAULT 25
, from_name VARCHAR2
, to_name VARCHAR2
, cc_name VARCHAR2 DEFAULT NULL
, bcc_name VARCHAR2 DEFAULT NULL
, subject VARCHAR2
, MESSAGE CLOB
, priority PLS_INTEGER DEFAULT NULL
, filename VARCHAR2 DEFAULT NULL
, binaryfile BLOB DEFAULT EMPTY_BLOB ( )
, DEBUG NUMBER DEFAULT 0 );
v_parm_value VARCHAR2 ( 4000 );
lbok BOOLEAN;
v_smtp_server VARCHAR2 ( 50 );
v_smtp_server_port NUMBER := 25;
crlf VARCHAR2 ( 10 ) := utl_tcp.crlf;
conn utl_tcp.connection;
p_debug_marker PLS_INTEGER := 0;
rc INTEGER;
p_from_name VARCHAR2 ( 100 );
p_to_name VARCHAR2 ( 4000 );
p_cc_name VARCHAR2 ( 4000 );
p_bcc_name VARCHAR2 ( 4000 );
p_subject VARCHAR2 ( 150 );
tx_timeout PLS_INTEGER := 240;
-- 240 Seconds (4 minutes);
p_datestring VARCHAR2 ( 100 )
:= 'Date: '
|| TO_CHAR ( SYSDATE, 'MM/DD/RR HH:MI AM' )
|| ' '
|| DBTIMEZONE
|| ' '
|| '(GMT'
|| DBTIMEZONE
|| ')';
-- Customize the signature that will appear in the email's MIME header.
-- Useful for versioning.
mailer_id CONSTANT VARCHAR2 ( 256 ) := 'Mailer by Oracle UTL_TCP';
max_base64_line_width CONSTANT PLS_INTEGER := 76 / 4 * 3;
END;
CREATE OR REPLACE PACKAGE BODY mail_tools
IS
PROCEDURE print_output (
p_message IN VARCHAR2 )
IS
BEGIN
dbms_output.put_line ( SUBSTR ( p_message
, 1
, 250 ));
IF LENGTH ( p_message ) > 250
THEN
dbms_output.put_line ( SUBSTR ( p_message
, 251
, 500 ));
END IF;
IF LENGTH ( p_message ) > 500
THEN
dbms_output.put_line ( SUBSTR ( p_message
, 501
, 750 ));
END IF;
IF LENGTH ( p_message ) > 750
THEN
dbms_output.put_line ( SUBSTR ( p_message
, 751
, 1000 ));
END IF;
EXCEPTION
WHEN OTHERS
THEN
NULL; -- Ignore errors... protect buffer overflow's etc.
END print_output;
FUNCTION dump_flatfile (
p_query IN VARCHAR2
, p_dir IN VARCHAR2
, p_filename IN VARCHAR2
, p_separator IN VARCHAR2
, p_headers IN BOOLEAN DEFAULT FALSE
, p_trailing_separator IN BOOLEAN DEFAULT FALSE
, p_max_linesize IN NUMBER DEFAULT 32000
, p_mode IN VARCHAR2 DEFAULT 'w' )
RETURN NUMBER
IS
l_output utl_file.file_type;
l_thecursor INTEGER DEFAULT dbms_sql.open_cursor;
l_columnvalue VARCHAR2 ( 4000 );
l_status INTEGER;
l_colcnt NUMBER DEFAULT 0;
l_cnt NUMBER DEFAULT 0;
l_separator VARCHAR2 ( 10 ) DEFAULT '';
l_line LONG;
l_desctbl dbms_sql.desc_tab;
v_sqlerrm VARCHAR2 ( 32000 );
l_mode CHAR ( 1 ) := 'w';
BEGIN
IF p_mode NOT IN ( 'w', 'a' )
THEN
l_mode := 'w';
ELSE
l_mode := p_mode;
END IF;
l_output := utl_file.fopen ( p_dir
, p_filename
, l_mode
, p_max_linesize );
dbms_sql.parse ( l_thecursor
, p_query
, dbms_sql.native );
dbms_sql.describe_columns ( l_thecursor
, l_colcnt
, l_desctbl );
FOR i IN 1 .. l_colcnt
LOOP
dbms_sql.define_column ( l_thecursor
, i
, l_columnvalue
, 4000 );
IF ( l_desctbl ( i ).col_type = 2 ) /* number type */
THEN
l_desctbl ( i ).col_max_len := l_desctbl ( i ).col_precision + 2;
ELSIF ( l_desctbl ( i ).col_type = 12 ) /* date type */
THEN
/* length of my date format */
l_desctbl ( i ).col_max_len := 20;
ELSIF ( l_desctbl ( i ).col_type = 8 ) /* LONG type */
THEN
l_desctbl ( i ).col_max_len := 2000;
END IF;
IF p_headers
THEN
utl_file.put ( l_output, l_separator || l_desctbl ( i ).col_name );
l_separator := p_separator;
END IF;
END LOOP;
IF p_trailing_separator
THEN
utl_file.put ( l_output, l_separator );
END IF;
IF p_headers
THEN
utl_file.new_line ( l_output );
END IF;
l_status := dbms_sql.EXECUTE ( l_thecursor );
LOOP
EXIT WHEN ( dbms_sql.fetch_rows ( l_thecursor ) <= 0 );
l_line := NULL;
l_separator := '';
FOR i IN 1 .. l_colcnt
LOOP
dbms_sql.COLUMN_VALUE ( l_thecursor
, i
, l_columnvalue );
IF NVL ( INSTR ( l_columnvalue, ',' ), 0 ) = 0
THEN
NULL;
ELSE
l_columnvalue := '"' || l_columnvalue || '"';
END IF;
utl_file.put ( l_output, l_separator || l_columnvalue );
l_separator := p_separator;
END LOOP;
IF p_trailing_separator
THEN
utl_file.put ( l_output, l_separator );
END IF;
utl_file.new_line ( l_output );
l_cnt := l_cnt + 1;
END LOOP;
dbms_sql.close_cursor ( l_thecursor );
utl_file.fclose ( l_output );
RETURN l_cnt;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
dbms_output.put_line ( 'NO_DATA_FOUND' );
utl_file.fclose ( l_output );
RETURN l_cnt;
WHEN utl_file.invalid_path
THEN
dbms_output.put_line ( 'UTL_FILE.INVALID_PATH' );
utl_file.fclose ( l_output );
RETURN l_cnt;
WHEN utl_file.read_error
THEN
dbms_output.put_line ( 'UTL_FILE.READ_ERROR' );
utl_file.fclose ( l_output );
RETURN l_cnt;
WHEN utl_file.write_error
THEN
dbms_output.put_line ( 'UTL_FILE.WRITE_ERROR' );
utl_file.fclose ( l_output );
RETURN l_cnt;
WHEN utl_file.invalid_mode
THEN
dbms_output.put_line ( 'UTL_FILE.INVALID_MODE' );
utl_file.fclose ( l_output );
RETURN l_cnt;
WHEN utl_file.invalid_filehandle
THEN
dbms_output.put_line ( 'UTL_FILE.INVALID_FILEHANDLE' );
utl_file.fclose ( l_output );
RETURN l_cnt;
WHEN utl_file.invalid_operation
THEN
dbms_output.put_line ( 'UTL_FILE.INVALID_OPERATION' );
utl_file.fclose ( l_output );
RETURN l_cnt;
WHEN utl_file.internal_error
THEN
dbms_output.put_line ( 'UTL_FILE.INTERNAL_ERROR' );
utl_file.fclose ( l_output );
RETURN l_cnt;
WHEN utl_file.invalid_maxlinesize
THEN
dbms_output.put_line ( 'UTL_FILE.INVALID_MAXLINESIZE' );
utl_file.fclose ( l_output );
RETURN l_cnt;
WHEN VALUE_ERROR
THEN
dbms_output.put_line ( 'UTL_FILE.VALUE_ERROR' );
utl_file.fclose ( l_output );
RETURN l_cnt;
WHEN OTHERS
THEN
hum_do.default_exception ( 'ERROR in dump_csv : ' );
utl_file.fclose ( l_output );
RETURN l_cnt;
END dump_flatfile;
-- Return the next email address in the list of email addresses, separated
-- by either a "," or a ";". The format of mailbox may be in one of these:
-- someone@some-domain
-- "Someone at some domain" <someone@some-domain>
-- Someone at some domain <someone@some-domain>
FUNCTION get_mail_address (
addr_list IN OUT VARCHAR2 )
RETURN VARCHAR2
IS
addr VARCHAR2 ( 256 );
i PLS_INTEGER;
FUNCTION lookup_unquoted_char (
str IN VARCHAR2
, chrs IN VARCHAR2 )
RETURN PLS_INTEGER
AS
c VARCHAR2 ( 5 );
i PLS_INTEGER;
len PLS_INTEGER;
inside_quote BOOLEAN;
BEGIN
inside_quote := FALSE;
i := 1;
len := LENGTH ( str );
WHILE ( i <= len )
LOOP
c := SUBSTR ( str
, i
, 1 );
IF ( inside_quote )
THEN
IF ( c = '"' )
THEN
inside_quote := FALSE;
ELSIF ( c = '\' )
THEN
i := i + 1;
-- Skip the quote character
END IF;
GOTO next_char;
END IF;
IF ( c = '"' )
THEN
inside_quote := TRUE;
GOTO next_char;
END IF;
IF ( INSTR ( chrs, c ) >= 1 )
THEN
RETURN i;
END IF;
<<next_char>>
i := i + 1;
END LOOP;
RETURN 0;
END;
BEGIN
addr_list := LTRIM ( addr_list );
i := lookup_unquoted_char ( addr_list, ',;' );
IF ( i >= 1 )
THEN
addr := SUBSTR ( addr_list
, 1
, i - 1 );
addr_list := SUBSTR ( addr_list, i + 1 );
ELSE
addr := addr_list;
addr_list := '';
END IF;
i := lookup_unquoted_char ( addr, '<' );
IF ( i >= 1 )
THEN
addr := SUBSTR ( addr, i + 1 );
i := INSTR ( addr, '>' );
IF ( i >= 1 )
THEN
addr := SUBSTR ( addr
, 1
, i - 1 );
END IF;
END IF;
RETURN addr;
END;
FUNCTION smtp_command (
command IN VARCHAR2
, ok IN VARCHAR2 DEFAULT '250'
, code OUT VARCHAR2
, DEBUG NUMBER DEFAULT 0 )
RETURN BOOLEAN
IS
response VARCHAR2 ( 3 );
p_output_message VARCHAR2 ( 255 );
len PLS_INTEGER;
PRAGMA AUTONOMOUS_TRANSACTION;
BEGIN
len := utl_tcp.write_line ( conn, command );
p_output_message := SUBSTR ( utl_tcp.get_line ( conn, TRUE )
, 1
, 255 );
response := SUBSTR ( p_output_message
, 1
, 3 );
p_output_message :=
SUBSTR ( command || ' - ' || p_output_message
, 1
, 255 );
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
IF ( response <> ok )
THEN
code := response;
RETURN FALSE;
ELSE
code := response;
RETURN TRUE;
END IF;
EXCEPTION
WHEN OTHERS
THEN
p_output_message := SQLCODE || ' - ' || SQLERRM;
code := p_output_message;
RETURN FALSE;
END smtp_command;
FUNCTION query_server (
smtp_server VARCHAR2
, smtp_server_port PLS_INTEGER DEFAULT 25
, DEBUG NUMBER DEFAULT 0 )
RETURN BOOLEAN
IS
p_output_message VARCHAR2 ( 255 );
PRAGMA AUTONOMOUS_TRANSACTION;
err_noop EXCEPTION; -- SMTP code 250 not received
err_server_reject EXCEPTION;
-- SMTP code 421 means rejected
BEGIN
v_smtp_server := smtp_server;
v_smtp_server_port := smtp_server_port;
-- Open the SMTP connection ...
conn :=
utl_tcp.open_connection ( remote_host => v_smtp_server
, remote_port => v_smtp_server_port
, tx_timeout => tx_timeout );
----- OPEN SMTP PORT CONNECTION
rc := utl_tcp.write_line ( conn, 'HELO ' || v_smtp_server );
-- This will return a 250 OK response if your connection is valid
-- Initial handshaking ...
----- PERFORMS HANDSHAKING WITH SMTP SERVER
p_output_message := utl_tcp.get_line ( conn, TRUE );
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
IF SUBSTR ( p_output_message
, 1
, 3 ) = '421'
THEN
RAISE err_server_reject;
END IF;
-- NOOP THE SERVER
rc := utl_tcp.write_line ( conn, 'NOOP' );
-- This will return a 250 OK response if your connection is valid
-- Initial handshaking ...
----- PERFORMS NOOP WITH SMTP SERVER
p_output_message := utl_tcp.get_line ( conn, TRUE );
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
IF SUBSTR ( p_output_message
, 1
, 3 ) <> '250'
THEN
RAISE err_noop;
END IF;
rc := utl_tcp.write_line ( conn, 'QUIT' );
----- ENDS EMAIL TRANSACTION
BEGIN
FOR i_idx IN 1 .. 100
LOOP
p_output_message := utl_tcp.get_line ( conn, TRUE );
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
END;
utl_tcp.close_connection ( conn ); ----- CLOSE SMTP PORT CONNECTION
RETURN TRUE;
EXCEPTION
WHEN err_server_reject
THEN
print_output ( 'ERROR -'
|| ' Server Rejected Connection ::'
|| ' SERVER_MSG := '
|| p_output_message );
RETURN FALSE;
WHEN err_noop
THEN
print_output ( 'ERROR -'
|| ' NOOP Check Failed ::'
|| ' SERVER_MSG := '
|| p_output_message );
utl_tcp.close_connection ( conn ); ----- CLOSE SMTP PORT CONNECTION
RETURN FALSE;
END query_server;
FUNCTION get_local_binary_data (
p_dir IN VARCHAR2
, p_file IN VARCHAR2 )
RETURN BLOB
IS
l_bfile BFILE;
l_data BLOB;
l_dbdir VARCHAR2 ( 100 ) := p_dir;
BEGIN
dbms_lob.createtemporary ( lob_loc => l_data
, CACHE => TRUE
, dur => dbms_lob.CALL );
l_bfile := BFILENAME ( l_dbdir, p_file );
dbms_lob.fileopen ( l_bfile, dbms_lob.file_readonly );
dbms_lob.loadfromfile ( l_data
, l_bfile
, dbms_lob.getlength ( l_bfile ));
dbms_lob.fileclose ( l_bfile );
RETURN l_data;
EXCEPTION
WHEN OTHERS
THEN
print_output ( 'Error during GET_LOCAL_BINARY_DATA :: '
|| SQLCODE
|| ' - '
|| SQLERRM );
dbms_lob.fileclose ( l_bfile );
RAISE;
END get_local_binary_data;
PROCEDURE attach_base64 (
conn IN OUT NOCOPY utl_tcp.connection
, DATA IN BLOB )
IS
i PLS_INTEGER;
len PLS_INTEGER;
l_result PLS_INTEGER;
l_buffer RAW ( 32767 );
l_pos INTEGER := 1;
l_blob_len INTEGER;
l_amount BINARY_INTEGER := 32767;
req utl_http.req;
resp utl_http.resp;
pdata RAW ( 200 );
BEGIN
-- Split the Base64-encoded attachment into multiple lines
-- In writing Base-64 encoded text following the MIME format below,
-- the MIME format requires that a long piece of data must be splitted
-- into multiple lines and each line of encoded data cannot exceed
-- 80 characters, including the new-line characters. Also, when
-- splitting the original data into pieces, the length of each chunk
-- of data before encoding must be a multiple of 3, except for the
-- last chunk. The constant MAX_BASE64_LINE_WIDTH
-- (76 / 4 * 3 = 57) is the maximum length (in bytes) of each chunk
-- of data before encoding.
l_blob_len := dbms_lob.getlength ( DATA );
WHILE l_pos < l_blob_len
LOOP
l_amount := max_base64_line_width;
dbms_lob.READ ( DATA
, l_amount
, l_pos
, l_buffer );
rc := utl_tcp.write_raw ( conn, utl_encode.base64_encode ( l_buffer ));
utl_tcp.FLUSH ( conn );
l_pos := l_pos + max_base64_line_width;
rc := utl_tcp.write_line ( conn, crlf );
END LOOP;
END attach_base64;
PROCEDURE sendmail (
smtp_server VARCHAR2
, smtp_server_port PLS_INTEGER DEFAULT 25
, from_name VARCHAR2
, to_name VARCHAR2
, cc_name VARCHAR2 DEFAULT NULL
, bcc_name VARCHAR2 DEFAULT NULL
, subject VARCHAR2
, MESSAGE CLOB
, priority PLS_INTEGER DEFAULT NULL
, filename VARCHAR2 DEFAULT NULL
, binaryfile BLOB DEFAULT EMPTY_BLOB ( )
, DEBUG NUMBER DEFAULT 0 )
IS
pos PLS_INTEGER := 1;
bytes_o_data CONSTANT PLS_INTEGER := 32767;
offset PLS_INTEGER := bytes_o_data;
msg_length CONSTANT PLS_INTEGER
:= dbms_lob.getlength ( MESSAGE );
v_line VARCHAR2 ( 32767 );
i BINARY_INTEGER;
v_slash_pos NUMBER;
my_recipients VARCHAR2 ( 32767 );
p_recipient_count PLS_INTEGER := 0;
p_output_message VARCHAR2 ( 2000 );
PRAGMA AUTONOMOUS_TRANSACTION;
err_server_reject EXCEPTION;
-- SMTP code 421 means rejected
err_message_send EXCEPTION; -- SMTP code must be 250
err_end_of_input EXCEPTION;
-- Used to signify last line of input retrieved
l_result PLS_INTEGER;
l_buffer_b RAW ( 32767 );
l_amount BINARY_INTEGER := 32767;
l_pos INTEGER := 1;
l_blob_len INTEGER;
l_blob BLOB;
g_debug BOOLEAN := TRUE;
i_base64 PLS_INTEGER;
len_base64 PLS_INTEGER;
BEGIN
v_smtp_server := smtp_server;
v_smtp_server_port := smtp_server_port;
l_blob := binaryfile;
-- Open the SMTP connection ...
conn :=
utl_tcp.open_connection ( remote_host => v_smtp_server
, remote_port => v_smtp_server_port
, tx_timeout => tx_timeout );
----- OPEN SMTP PORT CONNECTION
rc := utl_tcp.write_line ( conn, 'HELO ' || v_smtp_server );
-- Initial handshaking ...
----- PERFORMS HANDSHAKING WITH SMTP SERVER
p_output_message := utl_tcp.get_line ( conn, TRUE );
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
IF SUBSTR ( p_output_message
, 1
, 3 ) = '421'
THEN
RAISE err_server_reject;
ELSE
-- DBMS_OUTPUT.put_line (UTL_TCP.get_line (conn, TRUE));
rc := utl_tcp.write_line ( conn, 'MAIL FROM: ' || from_name );
----- MBOX SENDING THE EMAIL
p_output_message := utl_tcp.get_line ( conn, TRUE );
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
-- DBMS_OUTPUT.put_line (UTL_TCP.get_line (conn, TRUE));
-- rc := UTL_TCP.write_line (conn, 'RCPT TO: ' || to_name);
-- Specify recipient(s) of the email.
my_recipients := to_name;
WHILE ( my_recipients IS NOT NULL )
LOOP
BEGIN
rc :=
utl_tcp.write_line ( conn
, 'RCPT TO: '
|| get_mail_address ( my_recipients ));
p_recipient_count := p_recipient_count + 1;
END;
END LOOP;
-- DBMS_OUTPUT.put_line ('RCPT TO: COUNT ' || p_recipient_count);
----- MBOX RECV THE EMAIL
p_output_message := utl_tcp.get_line ( conn, TRUE );
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
-- DBMS_OUTPUT.put_line (UTL_TCP.get_line (conn, TRUE));
-- rc := UTL_TCP.write_line (conn, 'RCPT TO: ' || cc_name);
-- Specify cc recipient(s) of the email.
my_recipients := cc_name;
WHILE ( my_recipients IS NOT NULL )
LOOP
BEGIN
rc :=
utl_tcp.write_line ( conn
, 'RCPT TO: '
|| get_mail_address ( my_recipients ));
p_recipient_count := p_recipient_count + 1;
END;
END LOOP;
-- DBMS_OUTPUT.put_line ('RCPT TO: COUNT ' || p_recipient_count);
----- MBOX RECV THE EMAIL
p_output_message := utl_tcp.get_line ( conn, TRUE );
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
-- DBMS_OUTPUT.put_line (UTL_TCP.get_line (conn, TRUE));
-- rc := UTL_TCP.write_line (conn, 'RCPT TO: ' || bcc_name);
-- Specify bcc recipient(s) of the email.
my_recipients := bcc_name;
WHILE ( my_recipients IS NOT NULL )
LOOP
BEGIN
rc :=
utl_tcp.write_line ( conn
, 'RCPT TO: '
|| get_mail_address ( my_recipients ));
p_recipient_count := p_recipient_count + 1;
END;
END LOOP;
-- DBMS_OUTPUT.put_line ('RCPT TO: COUNT ' || p_recipient_count);
----- MBOX RECV THE EMAIL
p_output_message := utl_tcp.get_line ( conn, TRUE );
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
-- DBMS_OUTPUT.put_line (UTL_TCP.get_line (conn, TRUE));
rc := utl_tcp.write_line ( conn, 'DATA' );
----- EMAIL MSG BODY START
p_output_message := utl_tcp.get_line ( conn, TRUE );
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
-- DBMS_OUTPUT.put_line (UTL_TCP.get_line (conn, TRUE));
-- build the start of the mail message ...
rc := utl_tcp.write_line ( conn, p_datestring );
rc := utl_tcp.write_line ( conn, 'From: ' || from_name );
rc := utl_tcp.write_line ( conn, 'Subject: ' || subject );
rc := utl_tcp.write_line ( conn, 'To: ' || to_name );
IF cc_name IS NOT NULL
THEN
rc := utl_tcp.write_line ( conn, 'Cc: ' || cc_name );
END IF;
IF bcc_name IS NOT NULL
THEN
rc := utl_tcp.write_line ( conn, 'Bcc: ' || bcc_name );
END IF;
rc := utl_tcp.write_line ( conn, 'Mime-Version: 1.0' );
-- Set priority:
-- High Normal Low
-- 1 2 3 4 5
IF ( priority IS NOT NULL )
THEN
rc := utl_tcp.write_line ( conn, 'X-Priority: ' || priority );
END IF;
rc := utl_tcp.write_line ( conn, 'X-Mailer: ' || mailer_id );
rc :=
utl_tcp.write_line
( conn
, 'Content-Type: multipart/mixed; boundary="=_mixed 0052287A85256E75_="' );
rc := utl_tcp.write_line ( conn, '' );
rc :=
utl_tcp.write_line
( conn
, 'This is a Mime message, which your current mail reader may not' );
rc :=
utl_tcp.write_line
( conn
, 'understand. Parts of the message will appear as text. If the remainder' );
rc :=
utl_tcp.write_line
( conn
, 'appears as random characters in the message body, instead of as' );
rc :=
utl_tcp.write_line
( conn
, 'attachments, then you''ll have to extract these parts and decode them' );
rc := utl_tcp.write_line ( conn, 'manually.' );
rc := utl_tcp.write_line ( conn, '' );
rc := utl_tcp.write_line ( conn, '--=_mixed 0052287A85256E75_=' );
rc :=
utl_tcp.write_line ( conn
, 'Content-Type: text/html; charset=8859-1' );
rc := utl_tcp.write_line ( conn, '' );
rc := utl_tcp.write_line ( conn, '<html>' );
rc := utl_tcp.write_line ( conn, '<head>' );
rc :=
utl_tcp.write_line
( conn
, '<meta http-equiv="Content-Type" content="text/html;charset=8859-1">' );
rc := utl_tcp.write_line ( conn, '<title>' );
rc := utl_tcp.write_line ( conn, subject );
rc := utl_tcp.write_line ( conn, '</title>' );
rc := utl_tcp.write_line ( conn, '</head>' );
rc := utl_tcp.write_line ( conn, '<body>' );
WHILE pos < msg_length
LOOP
rc :=
utl_tcp.write_line ( conn
, dbms_lob.SUBSTR ( MESSAGE
, offset
, pos ));
pos := pos + offset;
offset := LEAST ( bytes_o_data, msg_length - offset );
END LOOP;
rc := utl_tcp.write_line ( conn, '<BR><BR>' );
rc := utl_tcp.write_line ( conn, '</body></html>' );
rc := utl_tcp.write_line ( conn, '' );
rc := utl_tcp.write_line ( conn, crlf );
-- Append the file BLOB ...
-- If the filename has been supplied ... it will fail if the BLOB is empty
IF filename IS NOT NULL
THEN
BEGIN
-- generate the MIME boundary line ...
rc :=
utl_tcp.write_line ( conn, '--=_mixed 0052287A85256E75_=' );
rc :=
utl_tcp.write_line
( conn
, 'Content-Type: application/octet-stream; name="'
|| filename
|| '"' );
rc :=
utl_tcp.write_line
( conn
, 'Content-Disposition: attachment; filename="'
|| filename
|| '"' );
rc :=
utl_tcp.write_line ( conn
, 'Content-Transfer-Encoding: base64' );
rc := utl_tcp.write_line ( conn, '' );
rc := utl_tcp.write_line ( conn, '' );
-- and append the file contents to the end of the message ...
-- Go get the file and the loop through blob and attach data
-- and append the file contents to the end of the message ...
attach_base64 ( conn => conn
, DATA => l_blob );
EXCEPTION
WHEN OTHERS
THEN
p_output_message :=
'Error in attaching file '
|| filename
|| ' :: '
|| SQLCODE
|| ' - '
|| SQLERRM;
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
RAISE err_message_send;
END;
END IF;
rc := utl_tcp.write_line ( conn, '' );
-- append the final boundary line ...
rc := utl_tcp.write_line ( conn, '' );
rc := utl_tcp.write_line ( conn, '--=_mixed 0052287A85256E75_=--' );
rc := utl_tcp.write_line ( conn, '' );
-- and close the SMTP connection ...
rc := utl_tcp.write_line ( conn, '.' );
----- EMAIL MESSAGE BODY END
p_output_message := utl_tcp.get_line ( conn, TRUE );
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
-- DBMS_OUTPUT.put_line (UTL_TCP.get_line (conn, TRUE));
rc := utl_tcp.write_line ( conn, 'QUIT' );
----- ENDS EMAIL TRANSACTION
p_output_message := utl_tcp.get_line ( conn, TRUE );
-- Capture '.' Message sent dialog
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
BEGIN
FOR i_idx IN 1 .. 100
LOOP
p_output_message := utl_tcp.get_line ( conn, TRUE );
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
END LOOP;
EXCEPTION
WHEN OTHERS
THEN
IF DEBUG = 1
THEN -- No Output
NULL;
ELSE -- Then DBMS_OUTPUT messages
print_output ( p_output_message );
END IF;
END;
END IF; -- err_server_reject
utl_tcp.close_connection ( conn ); ----- CLOSE SMTP PORT CONNECTION
EXCEPTION
WHEN err_message_send
THEN
print_output ( CHR ( 10 )
|| CHR ( 10 )
|| 'ERROR -'
|| ' Message was not submitted for delivery' );
print_output ( ' [FROM_NAME := ' || from_name || '] ' );
print_output ( ' [TO_NAME := ' || to_name || '] ' );
print_output ( ' [CC_NAME := ' || cc_name || '] ' );
print_output ( ' [BCC_NAME := ' || bcc_name || '] ' );
print_output ( ' [SUBJECT := ' || subject || '] ' );
print_output ( ' SERVER_MSG := ' || p_output_message );
utl_tcp.close_connection ( conn ); ----- CLOSE SMTP PORT CONNECTION
WHEN err_server_reject
THEN
print_output ( CHR ( 10 )
|| CHR ( 10 )
|| 'ERROR -'
|| ' Server Rejected Email' );
print_output ( ' [FROM_NAME := ' || from_name || '] ' );
print_output ( ' [TO_NAME := ' || to_name || '] ' );
print_output ( ' [CC_NAME := ' || cc_name || '] ' );
print_output ( ' [BCC_NAME := ' || bcc_name || '] ' );
print_output ( ' [SUBJECT := ' || subject || '] ' );
print_output ( ' SERVER_MSG := ' || p_output_message );
WHEN OTHERS
THEN
print_output ( CHR ( 10 )
|| CHR ( 10 )
|| 'ERROR :: '
|| SQLCODE
|| ' - '
|| SQLERRM );
print_output ( ' [FROM_NAME := ' || from_name || '] ' );
print_output ( ' [TO_NAME := ' || to_name || '] ' );
print_output ( ' [CC_NAME := ' || cc_name || '] ' );
print_output ( ' [BCC_NAME := ' || bcc_name || '] ' );
print_output ( ' [SUBJECT := ' || subject || '] ' );
print_output ( ' SERVER_MSG := ' || p_output_message );
END sendmail;
END;
/Perhaps your new SMTP server requires a more secure form of authentication than AUTH LOGIN. If you telnet to this new SMTP server on port 25 you should be issue the HELO or EHLO command to find out what AUTH mechanisms the server supports. You could then alter your code to use one of the supported authentication mechanisms.
-
Smtp email with multiple attachments
Hi all,
I have searched for help with this VI, but can't really find any. I am trying to write a VI that will send emails with attachments, and I want it to be able to be able to do more than a single file. I believe the problem is that I don't know how to populate the clusters going to the "Attachments" array. I do not believe that I need to populate "Data" if I supply a path. How do I know if "Binary" should be true or false? How do I set the value "MIME content type", and how do I know what type to set? The following is the error message that I am getting.
Error 16500 occurred at 500 Command unknown: 'MIME-VERSION:' Possible reason(s):
LabVIEW: (Hex 0x4074) 500 Syntax error, command unrecognized. For example, the command line might be too long.
Thanks for any assistance.
Jim
Jim
LV 2013Jim,
I'd say the odds are good that your problem is the mail server input string, not the attachments array. For example, I now live in Tampa and can send mail successfully when I use the address of my current ISP's SMTP server (smtp-server.tampa.rr.com). But when I try the server I previously used in Texas (smtp-server.austin.rr.com), I get the exact same error that you reported. A more explicit error message would make troubleshooting easier, but the basic problem is that I'm trying to use an SMTP server that I no longer have access to (based on the IP address my ISP has assigned to me, presumably).
You can test this theory by configuring Outlook Express or Thunderbird or some other e-mail client to use the same outgoing SMTP server that you're trying to use in LabVIEW. If you can't send mail that way, it confirms that your mail server string is bad.
Then again, maybe the problem is that your SMTP server requires authentication, which isn't supported by the LabVIEW SMTP VIs. If that's the case, I recommend using the OpenG ogic-smtp library, which I have successfully used with an SMTP server that requires authentication. You might try that library regardless, if you continue to have problems with the native SMTP VIs.
Good luck,
John -
I have installed Oracle 10g (10.2.0.1) on Windows XP (SP2) machine at my home PC.There is a broadband connection on my home PC.I have installed UTL_MAIL package and then set SMTP_OUT_PARAMETER by the following SQL Statement.
My machine IP address is 192.168.0.3
SQl> alter system set smtp_out_server = 'smtp.bsnl.in:25' scope = 25;
Then we run the following script.
BEGIN
UTL_MAIL.SEND(
SENDER => '[email protected]',
RECIPIENTS => '[email protected]',
SUBJECT => 'Testing UTL_MAIL',
MESSAGE => 'The receipt of this email means'||
'that it works for UTL_MAIL'
END;
Then following error message comes.
BEGIN
ERROR at line 1:
ORA-29279: SMTP permanent error: 553 Authentication is required to send mail as
<[email protected]>
ORA-06512: at "SYS.UTL_SMTP", line 21
ORA-06512: at "SYS.UTL_SMTP", line 99
ORA-06512: at "SYS.UTL_SMTP", line 222
ORA-06512: at "SYS.UTL_MAIL", line 407
ORA-06512: at "SYS.UTL_MAIL", line 594
ORA-06512: at line 2
Can anybody suggest the solution of the above problem.Hi,
is your smtp server configured to use anonymous connection?
Attackwave
Reply Code Description
211 System status, or system help reply
214 Help message [Information on how to use the receiver or the meaning of a particular non-standard command; this reply is useful only to the human user]
220 <domain> Service ready
221 <domain> Service closing transmission channel
250 Requested mail action okay, completed
251 User not local; will forward to <forward-path>
252 OK, pending messages for node <node> started. Cannot VRFY user (for example, info is not local), but will take message for this user and attempt delivery.
253 OK, <messages> pending messages for node <node> started
354 Start mail input; end with <CRLF>.<CRLF>
355 Octet-offset is the transaction offset
421 <domain> Service not available, closing transmission channel (This may be a reply to any command if the service knows it must shut down.)
450 Requested mail action not taken: mailbox unavailable [for example, mailbox busy]
451 Requested action terminated: local error in processing
452 Requested action not taken: insufficient system storage
453 You have no mail.
454 TLS not available due to temporary reason. Encryption required for requested authentication mechanism.
458 Unable to queue messages for node <node>
459 Node <node> not allowed: reason
500 Syntax error, command unrecognized (This may include errors such as command line too long.)
501 Syntax error in parameters or arguments
502 Command not implemented
503 Bad sequence of commands
504 Command parameter not implemented
521 <Machine> does not accept mail.
530 Must issue a STARTTLS command first. Encryption required for requested authentication.
534 Authentication mechanism is too weak.
538 Encryption required for requested authentication mechanism.
550 Requested action not taken: mailbox unavailable [for , mailbox not found, no access]
551 User not local; please try <forward-path>
552 Requested mail action terminated: exceeded storage allocation
*553 Requested action not taken: mailbox name not allowed [for example, mailbox syntax incorrect]*
554 Transaction failed -
Groupwise and E-mail notification
I have to setup an e-mail notification system. the campus use groupwise as email server. I tried the example E-mail Notification but got the following error:
LabVIEW: (Hex 0x4074) 500 Syntax error, command unrecognized. For example, the command line might be too long.
Any clue ?
OlivierThat 500's coming from your SMTP server.
Need a CRLF at the end? Comma-, semicolon-, or tab-delimited string (if applicable)?
SMTP relay installed and configured on the server? -
The SMTP Error Code from a message that was not sucessfully delivered ?
hello,
I'm developing an aplication that uses Java Mail and
send emails, but I need to get the error code if this
email was not sucessfully delivered, use
mail.smtp.dsn.notify to destination return an email in case
of failure.
Thaks for your help.
rania+Do you mean the SMTP server reply codes? These are the codes that are returned when the client tries passing the message to the server. The are from RFC 821 (http://www.ietf.org/rfc/rfc0821.txt).
500 Syntax error, command unrecognized
[This may include errors such as command line too long]
501 Syntax error in parameters or arguments
502 Command not implemented
503 Bad sequence of commands
504 Command parameter not implemented
211 System status, or system help reply
214 Help message
[Information on how to use the receiver or the meaning of a
particular non-standard command; this reply is useful only
to the human user]
220 <domain> Service ready
221 <domain> Service closing transmission channel
421 <domain> Service not available,
closing transmission channel
[This may be a reply to any command if the service knows it
must shut down]
250 Requested mail action okay, completed
251 User not local; will forward to <forward-path>
450 Requested mail action not taken: mailbox unavailable
[E.g., mailbox busy]
550 Requested action not taken: mailbox unavailable
[E.g., mailbox not found, no access]
451 Requested action aborted: error in processing
551 User not local; please try <forward-path>
452 Requested action not taken: insufficient system storage
552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed
[E.g., mailbox syntax incorrect]
354 Start mail input; end with <CRLF>.<CRLF>
554 Transaction failed -
Hello,
I'm trying to send an email with an attachment using the smtp email send file under LV 7.1
When I run the vi the following message appears: " 500 syntax error , command unrecognized. For example , the command line might be too long".
The same if I use the email with data.vi example.
Thank you for your help.
AndrésHi Marco,
I've tried your suggestion and the message on the reply string is confused for me: " 220 ctsmtpout.frontal.corre o ESMTP Service ( 7.2.056.6) ready ".
I attach the vi that I'm trying to run. It is the one on the LV7.1/examples/comm/smtpex.llb EMail with Data.vi
Thank you for your help.
Best regards
Andrés
Attachments:
EMail with Data.vi 76 KB -
When I using SMTP Email Send Message in Labview 8.0 to send an email message and I get a error message as bellow:
Error 16500 occurred at 500 5.5.1 Command unrecognized: "MIME-Version: 1.0"
Possible reason(s):
LabVIEW: (Hex 0x4074) 500 Syntax error, command unrecognized. For example, the command line might be too long.
Where the mistake and how to solve this error to send an email by Labview 8.0.
Thank you.A couple of things. If you don't know what mail server you are using, you definitely need to get a hold of a network administator to see which one you use. Checking the mail server is a thing specific to the mail server itself, in other words there is no specific way that applies to them all. The example below requirs FDS 7.0 so if you don't have full developement system, it won't work. The handset question would be a great one to ask in another thread. I suggest also searching our website for information on that one as well. Hope that answers your questions.
Tyler H.
National Instruments
Attachments:
sendEmail.vi 66 KB -
FTP Adapter - ModificationTimeFormat -issue
Hi,
We are using FTP adapter to poll a file from FTP server. We neither have an option to delete or archive files from that FTP remote server hence we are using "FileModificationTime" option. When we use this option, polling adapter errors out with ---
"Could not get file modification time for file :/testfile.txt. Verify that the values for the "ModificationTimeFormat" activation parameter are correct.Ensure the time format pattern and filename begin index and end index are specified according to the specific FTP server.
Check the error stack and fix the cause of the error. Contact oracle support if error is not fixable.
at oracle.tip.adapter.ftp.inbound.FTPSource.getTimestamp(FTPSource.java:1100)
at oracle.tip.adapter.file.inbound.FileList.isMinimumAgePeriod(FileList.java:462)
at oracle.tip.adapter.file.inbound.FileList.ignoreFile(FileList.java:497)
at oracle.tip.adapter.ftp.FTPClient.populateNlstResults(FTPClient.java:918)
at oracle.tip.adapter.ftp.FTPClient._listFiles(F"
Below is the synopsis of log file -
<2010-04-01 16:21:53,026> <DEBUG> <default.collaxa.cube.activation> <File Adapter::Inbound> Host test.ftp.server FTP command: MDTM /PGP BAM OUTBND UKFSBAM
<2010-04-01 16:21:53,078> <DEBUG> <default.collaxa.cube.activation> <File Adapter::Inbound> FTP Command: MDTM, reply:
500 command not understood
<2010-04-01 16:21:53,078> <WARN> <default.collaxa.cube.activation> <File Adapter::Inbound> FTPClient.getMDTM(): unexpected 500 is encountered.
<2010-04-01 16:21:53,078> <DEBUG> <default.collaxa.cube.activation> <File Adapter::Inbound> Host test.ftp.server FTP command: QUIT
<2010-04-01 16:21:53,129> <DEBUG> <default.collaxa.cube.activation> <File Adapter::Inbound> FTP Command: QUIT, reply:
221 Goodbye.
<2010-04-01 16:21:53,130> <ERROR> <default.collaxa.cube.activation> <File Adapter::Inbound> Could not get file modification time for : PGP BAM OUTBND UKFSBAM
<2010-04-01 16:21:53,130> <DEBUG> <default.collaxa.cube.activation> <File Adapter::Inbound> Control socket being read by [JCA-work-instance:FTP Adapter-27]
<2010-04-01 16:21:53,130> <DEBUG> <default.collaxa.cube.activation> <File Adapter::Inbound> Sending event: 1 with: oracle.tip.adapter.ftp.FTPConnection@f20ee14
<2010-04-01 16:21:53,130> <DEBUG> <default.collaxa.cube.activation> <File Adapter::Inbound> FTPManagedConnection::destroy called, closing physical socket
<2010-04-01 16:21:53,130> <DEBUG> <default.collaxa.cube.activation> <File Adapter::Inbound> Clearing Event Listeners
<2010-04-01 16:21:53,130> <DEBUG> <default.collaxa.cube.activation> <File Adapter::Inbound> Error retrieving polled files.
<2010-04-01 16:21:53,130> <DEBUG> <default.collaxa.cube.activation> <File Adapter::Inbound>
ORABPEL-11430
Error in listing files in the remote directory.
Unable to list file in remote directory.
Check the error stack and fix the cause of the error. Contact oracle support if error is not fixable.
at oracle.tip.adapter.ftp.FTPAgent.getFileList(FTPAgent.java:470)
at oracle.tip.adapter.file.inbound.FileSource.getFileList(FileSource.java:234)
at oracle.tip.adapter.file.inbound.PollWork.pollFiles(PollWork.java:254)
at oracle.tip.adapter.file.inbound.PollWork.run(PollWork.java:144)
at oracle.tip.adapter.fw.jca.work.WorkerJob.go(WorkerJob.java:51)
at oracle.tip.adapter.fw.common.ThreadPool.run(ThreadPool.java:280)
at java.lang.Thread.run(Thread.java:595)
Caused by: ORABPEL-11400
Can someone please help.
Thanks,
PhaniThe FTP server you're connecting to does not understnad the MDTM command the FTP adapter is configured to use in order to obtain the files date/time:
<2010-04-01 16:21:53,078> <DEBUG> <default.collaxa.cube.activation> <File Adapter::Inbound> FTP Command: MDTM, reply:
500 command not understood
Try using one of the other File Modification Time options in the FTP Adapter wizard such as Directory Listing or File Name Substring
Maybe you are looking for
-
String with embedded single quote
Hi, all. We're trying to pass a string from one procedure to another, which will then do an EXECUTE IMMEDIATE on it. However, there are single quotes withing the string, and they're driving us nuts! This is what the concatenated string should look li
-
Connecting iBook G3 as second monitor for iBook G4
I want to know if (and then how) I can connect my iBook G4 (running on OSX (10.4.5)) to an iBook G3, ultimately connecting the iBook G3 to a data projector, so that I can use presenter tools in PowerPoint. iBook G4, iBook G3 Mac OS X (10.4.5) iBook G
-
Unable to view photos on iphoto
After downloading mac os x on my macbook, my iphoto photos appear as blank files when i enlarge them. How can I fix this problem? Thank you for your help
-
HT4436 Can I create a second email account?
How do I create a second iCloud email account?
-
can any one give me any good object in ale /idocs and BAPI and explain them (senario where that is used and why and how . i will give you maximun reward points if i can understand that.