CREATE OR REPLACE PACKAGE demo_mail IS ----------------------- Customizable div ----------------------- -- Customize the SMTP host, port and your domain name below. smtp_host VARCHAR2(256) := 'smtp.eygle.com' ; smtp_port PLS_INTEGER := 25;
CREATE OR REPLACE PACKAGE demo_mail IS ----------------------- Customizable div ----------------------- -- Customize the SMTP host, port and your domain name below.smtp_host VARCHAR2(256) := 'smtp.eygle.com';smtp_port PLS_INTEGER := 25;smtp_domain VARCHAR2(256) := 'eygle.com'; -- Customize the signature that will appear in the email's MIME header.-- Useful for versioning.MAILER_ID CONSTANT VARCHAR2(256) := 'Mailer by Eygle'; --------------------- End Customizable div --------------------- -- A unique string that demarcates boundaries of parts in a multi-part email-- The string should not appear inside the body of any part of the email.-- Customize this if needed or generate this randomly dynamically.BOUNDARY CONSTANT VARCHAR2(256) := '-----7D81B75CCC90D2974F7A1CBD'; FIRST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || utl_tcp.CRLF;LAST_BOUNDARY CONSTANT VARCHAR2(256) := '--' || BOUNDARY || '--' ||utl_tcp.CRLF; -- A MIME type that denotes multi-part email (MIME) messages.MULTIPART_MIME_TYPE CONSTANT VARCHAR2(256) := 'multipart/mixed; boundary="'||BOUNDARY || '"';MAX_BASE64_LINE_WIDTH CONSTANT PLS_INTEGER := 76 / 4 * 3; -- A simple email API for sending email in plain text in a single call.-- The format of an email address is one of these:-- someone@some-domain-- "Someone at some domain" -- Someone at some domain -- The recipients is a list of email addresses separated by-- either a "," or a ";"PROCEDURE mail(sender IN VARCHAR2,recipients IN VARCHAR2,subject IN VARCHAR2,message IN VARCHAR2); -- Extended email API to send email in HTML or plain text with no size limit.-- First, begin the email by begin_mail(). Then, call write_text() repeatedly-- to send email in ASCII piece-by-piece. Or, call write_mb_text() to send-- email in non-ASCII or multi-byte character set. End the email with-- end_mail().FUNCTION begin_mail(sender IN VARCHAR2,recipients IN VARCHAR2,subject IN VARCHAR2,mime_type IN VARCHAR2 DEFAULT 'text/plain',priority IN PLS_INTEGER DEFAULT NULL)RETURN utl_smtp.connection; -- Write email body in ASCIIPROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,message IN VARCHAR2); -- Write email body in non-ASCII (including multi-byte). The email body-- will be sent in the database character set.PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,message IN VARCHAR2); -- Write email body in binaryPROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,message IN RAW); -- APIs to send email with attachments. Attachments are sent by sending-- emails in "multipart/mixed" MIME format. Specify that MIME format when-- beginning an email with begin_mail(). -- Send a single text attachment.PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,data IN VARCHAR2,mime_type IN VARCHAR2 DEFAULT 'text/plain',inline IN BOOLEAN DEFAULT TRUE,filename IN VARCHAR2 DEFAULT NULL,last IN BOOLEAN DEFAULT FALSE); -- Send a binary attachment. The attachment will be encoded in Base-64-- encoding format.PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,data IN RAW,mime_type IN VARCHAR2 DEFAULT 'application/octet',inline IN BOOLEAN DEFAULT TRUE,filename IN VARCHAR2 DEFAULT NULL,last IN BOOLEAN DEFAULT FALSE); -- Send an attachment with no size limit. First, begin the attachment-- with begin_attachment(). Then, call write_text repeatedly to send-- the attachment piece-by-piece. If the attachment is text-based but-- in non-ASCII or multi-byte character set, use write_mb_text() instead.-- To send binary attachment, the binary content should first be-- encoded in Base-64 encoding format using the demo package for 8i,-- or the native one in 9i. End the attachment with end_attachment.PROCEDURE begin_attachment(conn IN OUT NOCOPY utl_smtp.connection,mime_type IN VARCHAR2 DEFAULT 'text/plain',inline IN BOOLEAN DEFAULT TRUE,filename IN VARCHAR2 DEFAULT NULL,transfer_enc IN VARCHAR2 DEFAULT NULL); -- End the attachment.PROCEDURE end_attachment(conn IN OUT NOCOPY utl_smtp.connection,last IN BOOLEAN DEFAULT FALSE); -- End the email.PROCEDURE end_mail(conn IN OUT NOCOPY utl_smtp.connection); -- Extended email API to send multiple emails in a session for better-- performance. First, begin an email session with begin_session.-- Then, begin each email with a session by calling begin_mail_in_session-- instead of begin_mail. End the email with end_mail_in_session instead-- of end_mail. End the email session by end_session.FUNCTION begin_session RETURN utl_smtp.connection; -- Begin an email in a session.PROCEDURE begin_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection,sender IN VARCHAR2,recipients IN VARCHAR2,subject IN VARCHAR2,mime_type IN VARCHAR2 DEFAULT 'text/plain',priority IN PLS_INTEGER DEFAULT NULL); -- End an email in a session.PROCEDURE end_mail_in_session(conn IN OUT NOCOPY utl_smtp.connection); -- End an email session.PROCEDURE end_session(conn IN OUT NOCOPY utl_smtp.connection); END;/CREATE OR REPLACE PACKAGE BODY demo_mail IS -- 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 at some domain FUNCTION get_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 ASc VARCHAR2(5);i pls_integer;len pls_integer;inside_quote BOOLEAN;BEGINinside_quote := false;i := 1;len := length(str);WHILE (i = 1) THENRETURN i;END IF; i := i + 1; END LOOP; RETURN 0; END; BEGIN addr_list := ltrim(addr_list);i := lookup_unquoted_char(addr_list, ',;');IF (i >= 1) THENaddr := substr(addr_list, 1, i - 1);addr_list := substr(addr_list, i + 1);ELSEaddr := addr_list;addr_list := '';END IF; i := lookup_unquoted_char(addr, '');IF (i >= 1) THENaddr := substr(addr, 1, i - 1);END IF;END IF; RETURN addr;END; -- Write a MIME headerPROCEDURE write_mime_header(conn IN OUT NOCOPY utl_smtp.connection,name IN VARCHAR2,value IN VARCHAR2) ISBEGINutl_smtp.write_data(conn, name || ': ' || value || utl_tcp.CRLF);END; -- Mark a message-part boundary. Set to TRUE for the last boundary.PROCEDURE write_boundary(conn IN OUT NOCOPY utl_smtp.connection,last IN BOOLEAN DEFAULT FALSE) ASBEGINIF (last) THENutl_smtp.write_data(conn, LAST_BOUNDARY);ELSEutl_smtp.write_data(conn, FIRST_BOUNDARY);END IF;END; ------------------------------------------------------------------------PROCEDURE mail(sender IN VARCHAR2,recipients IN VARCHAR2,subject IN VARCHAR2,message IN VARCHAR2) ISconn utl_smtp.connection;BEGINconn := begin_mail(sender, recipients, subject);write_text(conn, message);end_mail(conn);END; ------------------------------------------------------------------------FUNCTION begin_mail(sender IN VARCHAR2,recipients IN VARCHAR2,subject IN VARCHAR2,mime_type IN VARCHAR2 DEFAULT 'text/plain',priority IN PLS_INTEGER DEFAULT NULL)RETURN utl_smtp.connection ISconn utl_smtp.connection;BEGINconn := begin_session;begin_mail_in_session(conn, sender, recipients, subject, mime_type,priority);RETURN conn;END; ------------------------------------------------------------------------PROCEDURE write_text(conn IN OUT NOCOPY utl_smtp.connection,message IN VARCHAR2) ISBEGINutl_smtp.write_data(conn, message);END; ------------------------------------------------------------------------PROCEDURE write_mb_text(conn IN OUT NOCOPY utl_smtp.connection,message IN VARCHAR2) ISBEGINutl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(message));END; ------------------------------------------------------------------------PROCEDURE write_raw(conn IN OUT NOCOPY utl_smtp.connection,message IN RAW) ISBEGINutl_smtp.write_raw_data(conn, message);END; ------------------------------------------------------------------------PROCEDURE attach_text(conn IN OUT NOCOPY utl_smtp.connection,data IN VARCHAR2,mime_type IN VARCHAR2 DEFAULT 'text/plain',inline IN BOOLEAN DEFAULT TRUE,filename IN VARCHAR2 DEFAULT NULL,last IN BOOLEAN DEFAULT FALSE) ISBEGINbegin_attachment(conn, mime_type, inline, filename);write_text(conn, data);end_attachment(conn, last);END; ------------------------------------------------------------------------PROCEDURE attach_base64(conn IN OUT NOCOPY utl_smtp.connection,data IN RAW,mime_type IN VARCHAR2 DEFAULT 'application/octet',inline IN BOOLEAN DEFAULT TRUE,filename IN VARCHAR2 DEFAULT NULL,last IN BOOLEAN DEFAULT FALSE) ISi PLS_INTEGER;len PLS_INTEGER;BEGIN begin_attachment(conn, mime_type, inline, filename, 'base64'); -- Split the Base64-encoded attachment into multiple linesi := 1;len := utl_raw.length(data);WHILE (i
ASP.NET 4.0电子商城查看详情在现实生活中的购物过程,购物者需要先到商场,找到指定的产品柜台下,查看产品实体以及标价信息,如果产品合适,就将该产品放到购物车中,到收款处付款结算。电子商务网站通过虚拟网页的形式在计算机上摸拟了整个过程,首先电子商务设计人员将产品信息分类显示在网页上,用户查看网页上的产品信息,当用户看到了中意的产品后,可以将该产品添加到购物车,最后使用网上支付工具进行结算,而货物将由公司通过快递等方式发送给购物者
0
![]()
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号