How to send emails with attachments located on disc using PL/SQL? - email

I have a ready script which sends email using PL/SQL. It has been stored in a procedure and when it is called by passing proper parameters, it sends email.
Now, I need to pick up a file from the disc and send it as an attachment. I have seen many examples where the data is stored in BLOB and comes from the DB. In my case it is not from DB instead it is a file on the server/disc.
How to achieve this ?

Use UTL_FILE to read data from disk.
You can find a good example of how to use it to load an entire file into a BLOB in the Alexandria PL/SQL Library. Look at (or just copy!) the code from file_util_pkg.get_blob_from_file.

ORACLE DIRECTORIES can be used to achieve this.
link to a full email/smtp example

Related

How to send an email with attachment using apex (PL/SQL) without storing the attachment in server

I wanted to send an email with attachment from the oracle apex workspace, currently i am using the APEX_MAIL package which includes (APEX_ATTACHMENT, APEX_EXPORT functions). But the issue is, we are creating an CSV file and adding it as a mail attachment while sending the email and the attachments are sometimes larger in size which are getting stored in server each time the mail is triggered. This issue is causing a regular maintenance for the DBA to clear the data in the server.
Can anyone suggest is there any alternative for the current approach in order to come out of the issue.
Thanks in advance.
I tried oracle APEX_MAIL but the attachment is saving in database, please provide the alternate approach for the solution.
If you are generating the attachment CSV in the procedure as a BLOB variable, you can use it as described here. The only difference would be you should send your blob variable for p_attachment parameter.
For example:
apex_mail.add_attachment(
p_mail_id => l_id,
p_attachment => v_CSV, --the CSV file that you generated and assigned to a variable of type BLOB
p_filename => l_filename,
p_mime_type => l_mime_type,
p_content_id => l_content_id );
If you do not generate the CSV file in the package yourself, another approach would be using an intermediate table where you save your attachment file and having a scheduled job that clears that intermediate table on a specified basis. (You can clear the table after the mail is sent but for the logging/reporting it would be better to keep the attachments for a while I believe).

Google Cloud Storage Python API: blob rename, where is copy_to

I am trying to rename a blob (which can be quite large) after having uploaded them to a temporary location in the bucket.
Reading the documentation it says:
Warning: This method will first duplicate the data and then delete the old blob. This means that with very large objects renaming could be a very (temporarily) costly or a very slow operation. If you need more control over the copy and deletion, instead use google.cloud.storage.blob.Blob.copy_to and google.cloud.storage.blob.Blob.delete directly.
But I can find absolutely no reference to copy_to anywhere in the SDK (or elsewhere really).
Is there any way to rename a blob from A to B without the SDK copying the file. In my case overwriting B, but I can remove B first if it's easier.
The reason is checksum validation, I'll upload it under A first to make sure it's successfully uploaded (and doesn't trigger DataCorruption) and only then replace B (the live object)
GCS itself does not support renaming objects. Renaming with a copy+delete is done in the client as a helper, and there is no better way to rename an object at the moment.
As you say your goal is checksum validation, there is a better solution. Upload directly to your destination and use GCS's built in checksum verification. How you do this depends on the API:
JSON objects.insert: Set crc32c or md5Hash header.
XML PUT object: Set x-goog-hash header.
Python SDK Blob.upload_from_* methods: Set checksum="crc32c" or checksum="md5" method parameter.

Saving CKAsset from Core Data

I have some data like pictures, stored in Core Data as binary data and marked as "Allows External Storage". I'd like to write this data to the CloudKit. Is it possible to get URLs for this data and pass it to CKAsset, or transform somehow this data to CKAsset without double writing this data to some temporary files? Thank you.
Accessing external binary data directly is not supported and there's no API for it. Unofficially it's not hard to figure out what directory the files are stored in, but it's not useful because
Filenames are UUIDs, and there's no documented way to link a managed object to a UUID, so you don't know which file to use.
The option is to allow external storage, so there's no guarantee that an external file exists. Some instances may not use external storage.
I'm not sure what CKAsset requires but you'll have to look up the binary data via the managed object first.

how to match server database in our local database table in iphone

hi friend
can any one tell me that i have web server there i have create the database for store some value for registration form the value was save in webserver this is working good
but now that data coming in json format and now i have fetch json value and save in to the local database which is same as the webserverdata base both the side ssame table and same colume name is there how can i do this
and how to writ the query for this sitution help me
Various JSON parsers exist for objective c. You'll have to pass the data to a library or to javascript in a webview to extract it. Here is a google library:
http://code.google.com/p/json-framework/
If you need help with saving the data, I say with no snideness whatsoever that you should read the manual:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdUsingMOM.html
In

iPhone data exchange using eMail

In my application I want to be able to send data to a user who can then import it into some other application - a report writer, spreadsheet, database or whatever else.
I'm looking at various techniques and would like input from the community. I intend sending an email with an attachment. The question is in what format, a tab or comma delimited file? A file of XML or .... what? The file is a representation of an NSMutableArray with some 600+ elements. I'm assuming the user doesn't have access to a relational database so SQL is not an option.
Advice and experiences greatly appreciated.
Comma delimited is the most importable, assuming your data can be represented in that way - XML is too generic, anything could read it but nothing would know what to do with it.