I looking to send the report or the Table as an attachment in the email, in oracle apex I have tried it show this error
ORA-20001: The printing engine could not be reached because either the URL specified is incorrect or a proxy URL needs to be specified. for Execute PL/SQL Code.
here is the code
DECLARE
l_id number;
l_document BLOB;
BEGIN
l_document := apex_util.get_print_document (
p_application_id => 127,
p_report_query_name => 'CatpbReport',
p_report_layout_name => 'CatpbReport',
p_report_layout_type => 'XSL-FO',
p_document_format => 'pdf' );
l_id := APEX_MAIL.SEND(
p_to => 'xxxxxxxxxxx',
p_from => 'xxxxxxxxxxxx',
p_subj => 'sending PDF by using print API',
p_body => 'Please review the attachment.',
p_body_html => 'Please review the attachment');
APEX_MAIL.ADD_ATTACHMENT (
p_mail_id => l_id,
p_attachment => l_document,
p_filename => 'mydocument.pdf',
p_mime_type => 'application/pdf'
);
END;
i don't know why it's not working for me when I tried in the SQL command it sends the email, when I attach in the dynamic action it shows this as an error.
don't you need printing server to use it?
not an answer to your question but as an alternative:
you can create html, doc, csv by hand, convert it to blob and add it as an attachment to your email.
create lob,
dbms_lob.createtemporary(lob_loc => l_body_blob, cache => true, dur =>dbms_lob.call);
then convert your clob to blob
dbms_lob.converttoblob (
dest_lob => l_body_blob,
src_clob => l_body_clob,
amount => dbms_lob.lobmaxsize,
dest_offset => l_dest_offset,
src_offset => l_source_offset,
blob_csid => dbms_lob.default_csid,
lang_context=> l_lang_context,
warning => l_warning);
then add it to your mail & send
l_mail_id :=
apex_mail.send (
p_to => 'foo#bar.nl',
p_from => 'goo#bar.nl',
p_body => l_body,
p_body_html => l_body,
p_subj => l_subject);
apex_mail.add_attachment(l_mail_id, l_body_blob, 'test.doc', 'application/msword');
optionally:
apex_mail.push_queue;
this way you should get an email with a DOC attachment.
Related
I am adding a folder module to a Moodle course using the API:
folder_add_instance($data, null);
I am getting the error below when running the script using CMD:
!!! Invalid course module ID !!!
I looked into the folder_add_instance() function in the library, the error is occurring when trying to get the context:
$context = context_module::instance($cmid)//$cmid = 8
i looked into the mdl_context table in Moodle database but couldn't understand the values and their relation to the error i am getting.
Will deleting the mdl_context values from the database will help? or i am missing something here?
Note that the script was working fine, until i deleted all the courses i had on Moodle using the web interface.(i deleted the category containing all the courses).
To programmatically create a module in Moodle you should use function add_moduleinfo().
Look at the example in the folder generator:
https://github.com/moodle/moodle/blob/master/mod/forum/tests/generator/lib.php#L67
Will be something like:
require_once($CFG->dirroot.'/course/modlib.php');
$foldername = 'YOUR NAME HERE';
$courseid = 12345;
$sectionnum = 0;
$course = get_course($courseid);
$moduleid = $DB->get_field('modules', 'id', array('name' => 'folder'));
$data = (object)array(
'name' => $foldername,
'intro' => '',
'display' => FOLDER_DISPLAY_PAGE,
'revision' => 1,
'showexpanded' => 1,
'files' => file_get_unused_draft_itemid(),
'visible' => 1,
'modulename' => 'folder',
'module' => $moduleid,
'section' => $sectionnum,
'introformat' => FORMAT_HTML,
'cmidnumber' => '',
'groupmode' => NOGROUPS,
'groupingid' => 0,
'availability' => null,
'completion' => 0,
'completionview' => 0,
'completionexpected' => 0,
'conditiongradegroup' => array(),
'conditionfieldgroup' => array(),
'conditioncompletiongroup' => array()
);
return add_moduleinfo($data, $course, $mform = null);
Invalid course module ID . That means moodle can find a course module record, but the cm doesn't actually exist in the course object when fetching all the course data.
What you can do to fix it is add the broken module back into a section of this course. It might be in a section that exists, then you also need to add the cmid to the sequence field. (Just add this cmid on the end of the existing sequence).
update mdl_course_modules set section=<existingsection> where id=cmid;
update mdl_course_sections set sequence='XX,YY,ZZ,cmid' where id =<existingsection>;
Then after you purge caches, you should now be able to view the module again, eg. for an assignment:
https://moodle.com/mod/assign/view.php?id=cmid
I'm new to Fuel...
got my script inserting a record using the following code:
$address = Model_Address::forge(array(
'street1' => $step1_data['street1'],
'street2' => $step1_data['street2'],
'suburb' => $step1_data['street2'],
'city' => $step1_data['city'],
'region' => $step1_data['region'],
'country' => $step1_data['country'],
'postcode' => $step1_data['postcode'],
));
$address->save();
I think I should be able to get the insert id via $address->id but it's empty.
I'm not sure what I'm doing wrong?
We are using pg_swl not sure if that makes any difference.
I want to send email with cakephp.
But I want send in the email with lot of data like
'Envoie' => array(
(int) 0 => array(
'id' => '59',
'compte_id' => '1',
'annonce_id' => '19',
'site_id' => '8',
'valider' => '0',
'lien' => null,
'created' => '2013-09-19 15:56:28'
),
in my code i have this
$Email = new CakeEmail();
$Email->template('default', 'a');
$envoie = $this->Envoie->find('all',array('conditions' => array(
'Envoie.annonce_id' =>$annonce['Annonce']['id'])));
$Email->viewVars(array("envoie"=>$envoie));
$Email->emailFormat('html');
$Email->to('email#hotmail.com');//$annonce['User']['username']
$Email->from('no-repley#domaine.com');
$Email->subject('subject');
$Email->send();
How i can send my table to my view ?
You have $envoie array in your view ie app/View/Emails/html/default.ctp.
For example, you can get value of id using $envoie['id'] and so on...
In your email template
app/View/Emails/html/default.ctp
You already have access to $envoie, just extract the variable's values to your needs.
my $csr = Net::OpenID::Consumer->new(
ua => LWP::UserAgent->new,
consumer_secret => '123456xXx',
required_root => "http://www.myopenidsample.net/",
);
my $openid = "https://me.yahoo.com";
my $claimed_id = $csr->claimed_identity($openid);
if ($claimed_id){
my $check_url = $claimed_id->check_url(
delayed_return => 1,
return_to => "http://www.myopenidsample.net/response.cgi",
trust_root => "http://www.myopenidsample.net/",
);
print $q->redirect($check_url);
}
How do I get attributes such as email, firstName, lastName, and country?
How do I append the following parameters to a URL?
openid.ext1.mode fetch_request
openid.ext1.required country,email,firstname,lastname,language
openid.ext1.type.country http://axschema.org/contact/country/home
openid.ext1.type.email http://axschema.org/contact/email
openid.ext1.type.firstname http://axschema.org/namePerson/first
openid.ext1.type.language http://axschema.org/pref/language
openid.ext1.type.lastname http://axschema.org/namePerson/
openid.ns.ext1 http://openid.net/srv/ax/1.0
You need to add the following code before the call to check_url (the example was tested with Google in order to get only the email):
$claimed_id->set_extension_args(
"http://openid.net/srv/ax/1.0",
{
'mode' => 'fetch_request',
'type.email' => 'http://axschema.org/contact/email',
'required' => 'email',
});
To get the value back in the return, I use:
my $email = $csr->message->get_ext
("http://openid.net/srv/ax/1.0", "value.email");
I am using this cakephp email plugin to pull the emails from the account. Here are my parameters
'datasource' => 'Emails.Imap',
'server' => 'mail.example.com',
'connect' => 'imap/novalidate-cert',
'username' => 'username',
'password' => 'password',
'port' => '143',
'ssl' => false,
'encoding' => 'UTF-8',
'error_handler' => 'php',
and I make a query as it is indicated in documentation
$ticketEmails = $this->TicketEmail->find('first', array('recursive' => -1));
but when I debug the result, the following fields show data like this
Array
(
[TicketEmail] => Array
(
. . . other fields
[body] => CjxIVE1MPjxCT0RZPnNvbWUgbWVzc2FnZTxicj48L0JPRFk+PC9IVE1MPgo=
[plainmsg] => IHNvbWUgbWVzc2FnZQo=
. . . other fields
)
)
I can not understand why it shows these strings, e.g. in email account's message's body is just this text some message.
My cake version is 1.3
Thanks !
That's Base64 encoding, looks like the plugin doesn't handle that, it only checks for the quoted-printable format.
You could decode the data in your model, for example in the Model::afterFind() callback or in a custom method, or you could try modifying the plugin so that it returns the decoded data (untested):
protected function _fetchPart ($Part) {
$data = imap_fetchbody($this->Stream, $Part->uid, $Part->path, FT_UID | FT_PEEK);
if ($data) {
// remove the attachment check to decode them too
if ($Part->format === 'base64' && $Part->is_attachment === false) {
return base64_decode($data);
}
if ($Part->format === 'quoted-printable') {
return quoted_printable_decode($data);
}
}
return $data;
}