Sending certificate with custom attachment in moodle - moodle

In my moodle 2.6 i would like to edit sending certificate action to send certificate with attachments (my attachment would be 2 file from course) It's always different files but in courses have the same name.
1 is *pdf and second is mp3 file.
I know that i have to get that file to certificate send mail acrion and add it to email , i don't know how to do it and I need a little help. Can sb help me ?
Thanks for answers
Best Regards

Just noticed there is a function in /mod/certificate/lib.php that emails the certificate to a student:
certificate_email_student($course, $certificate, $certrecord, $context);
If you make a copy of that function and modify it for your cron - you will need to change $USER to $user - $USER is the current user but you will need to send it to a specified user.
The function also shows how to get a copy of a file using the file storage api
http://docs.moodle.org/dev/File_API

Related

Exchange 2016 - Unable to Send As on Mail Public Folder

Exchange 2016 using Outlook 2016 client
Created a new Public Folder titled
Mail-enabled the public folder:
Enable-MailPublicFolder -Identity "\PublicFolder"
Added Send As permissions.
Add-ADPermission PublicFolder -User domain\jsmith -Extendedrights "Send As"
Added permissions to receive mail.
Add-PublicFolderClientPermission -identity "\PublicFolder" -User Anonymous -AccessRights CreateItems
Set Hidden from address lists false:
Enable-MailPublicFolder -Identity "\PublicFolder" -HiddenFromAddressListsEnabled $False
The user jsmith is an owner of this public folder. He can add the public folder and the public folder can receive emails but nobody is able to "Send As" the public folder.
Under EAC I have verified that the public folder exists, permissions are in place, and the folder is mail-enabled.
I have tried disabling Mail Settings and re-enabling. I am also completely unable to select "PublicFolder" in my "From" field in OWA. It gives no option to enter a custom name and also doesn't have an option for the PublicFolder. I did add it to my Favorites.
The user receives the message "This message could not be sent. Try sending the message again later, or contact your network administrator. You do not have the permission to send the message on behalf of the specified user. Error is [0x80070005-0x0004dc-0x000524]."
The user has both Send As and Send on Behalf Of permissions.
The issue has lasted more than 24 hours so I am fairly certain that it is not a replication issue.
This kind of issues might be caused by a wide range of issues:
Make sure that you use the correct permissions as explained in KB 3045224
Make sure that you cleaned the client AutoCache as explained in KB 287623.
Make sure your GAL is updated (but I would say that should be the case after the 24 hours you waited)
Download the OAB by hand on the affected clients
Try to remove the mailbox / shared folder and re-add it on the client
Try to remove the email address from the list (there should be a X near that) and re-add it on the client to force a recheck from the config
Recheck/Reset the permissions via powershell to ensure you are using the correct one
Check KB 3131416 if it apply to your environment
There seamed to be some issues with hidden elements in Exchange. So check out the following URL if that apply to your situation.
Make sure the user has only "Send As" and not additional to that "Send on Behalf Of" rights.
More infos can be found in the source URL.
Outcome:
In your situation it looks like this is caused because the user has both "Send As" and "Send on Behalf Of" permissions. So please check solution 1 and fix the permission.
After long hours of research about this issue, this is the way to solve error 0x80070005-0x0004dc-0x000524 given by a send as on public folder.
Delete outlook Profile
rename in .OLD the folder c:\users\username\appdata\roaming\outlook or c:\users\username\appdata\roaming\microsoft\outlook
Create the new profile
If exists, Delete the autocomplete entry on field "from" with the little cross on the right.
Try to send
It works for me and hope it will be the same for you.
=> Works for Exchange 2013 and Outlook 2010 & 2013.

Intercept all emails sent from Xampp Mercury Mail Server

I have a Xampp Server that I use only in a development environment. In order to preview emails that would be sent from the live sites without actually sending them I would like to intercept all the emails sent from this server. I would like to be able to either send them all to a specific email or save them as files instead of sending them to whatever address they're set to go to. This way I can make sure they are correct without accidently sending emails during testing.
I found a similar question with an answer
here
but was unable to find a way to open any of the dialogs in the answer and so it didn't get me very far.
Thanks in advance for your help!
You can accomplish this using the sendmail configuration within your php.ini.
Create a file named smtp_catcher.php and the set the sendmail_path
sendmail_path = "php C:\path\to\file\smtp_catcher.php"
Then in your smtp_catcher.php add this block:
#!/Applications/XAMPP/xamppfiles/bin
<?php
# create a filename for the emlx file
list($ms, $time) = explode(' ', microtime());
$filename = dirname(__FILE__).'/'.date('Y-m-d h.i.s,', $time).substr($ms,2,3).'.emlx';
# write the email contents to the file
$email_contents = fopen('php://stdin', 'r');
$fstat = fstat($email_contents);
file_put_contents($filename, $fstat['size']."\n");
file_put_contents($filename, $email_contents, FILE_APPEND);
# open up the emlx file (using Apple Mail)
exec('open '.escapeshellarg($filename));
?>
Now I am not sure what extension you'll need to use to view the emails but this should catch all emails going out.
NOTE: make sure that php is in your window's environment PATH

How to retrieve the .xml extension attachments from mail by using MailCore to Sample iPhone app

How to retrieve the .xml extension attachments from mail by using MailCore for iphone?
I used MailCore to download the attachments from my mail to my sample iPhone app. I getting Inbox subjects from my mail that subjects I sort to get particular mail subject and mail attachments.
The problem is I got particular mail subject but not attachments. I used below code to get attachments from mail but it's not working.
NSArray *Array=[msg attachments];
CTBareAttachment *ctbaratt=[Array objectAtIndex:0];
CTCoreAttachment *ctcoreatt=[ctbaratt fetchFullAttachment];
but I'm getting :
Array count is zero
Please share your ideas.
This could be for a few reasons:
1)It is possible that you're not downloading enough information about the CTCoreMessage. When making a request to download the CTCoreMessages you must specify what information you want by specifying the correct fetch attributes.
For example:
[core_folder messagesFromSequenceNumber:from to:to withFetchAttributes: CTFetchAttrEnvelope | CTFetchAttrBodyStructure]
should populate the information about the attachments.
When fetching a message from IMAP, the command will specify exactly what information it wants.
you can see what is being fetched by enabling MailCore Logging as follows:
MailcoreEnableLogging();
[core_folder messagesFromSequenceNumber:from to:to withFetchAttributes: CTFetchAttrEnvelope | CTFetchAttrBodyStructure];
MailcoreDisableLogging();
You will see commands of the format
<command number> <UID> <Command> (<requested structure>)
I imagine you will see something like this:
1 UID FETCH (ENVELOPE)
You should ensure that inside the () either BODY or BODY[2] or RFC822 as these will contain information about attachments.
When you see what is actually being fetched you can read the RFC, if you are dealing with mailcore and IMAP then it is well worth the investment in time.
2)Failing that, perhaps your CTCoreAccount and/or CTCoreFolder are not connected, thus preventing the CTCoreMessage from having a valid mailimapsession and being unable to download the attachment information. If an attribute inside a CTCoreMessage is not available then libetpan should download it on request. The fact that is it not suggests that your account or folder may be not valid or connected.

Extract Email Address from Nested Tables in HTML Emails

I will be receiving approx 500 emails over the next day or so. The emails are all identical in layout i.e. HTML emails that display information inside a table. There are nested tables within the email.
I need to extract the email address from each email and store it in a file (text/csv). Rather than "copy & paste", is there a php script or some browser plugin I can use to do this?
GF
I will use php parse by id,class or name and a little script to go throw all the pages inside that folder to extract it as a csv I'll use fputcsv.
Hope it helped.

Configurating JOOMLA's e-mail notification for new account

I'm using Joomla 1.5 to create a local site for my office. The site will be accessed locally via intranet, and my PC will be the localhost for the site.
I'm using a Login pluggin, so that anyone who wanted to enter the site should create an account.
In JOOMLA, all user who created their account for the first time will receive a notification e-mail like :
"Hello pras,
You have been added as a User to Information Center by an
Administrator.
This e-mail contains your username and password to log in to
http://localhost/yaddayadda/
Username: hadisuryo.prasetio Password: xxxx
Please do not respond to this message as it is automatically generated
and is for information purposes only."
but if the user click the URL in the mail, which is, "localhost/yaddayadda/" they will not be directed to my site, but to their own PC's localhost....
My question is : How can I Modified the e-mail or the site configuration so that the URL will not be "localhost/yaddayadda/" anymore, but will be "(My-IP address)/yaddayadda"
I'm not going to host my site to a web hosting service, just using my PC as a host.
I've been trying to trace on each config and .ini files...it seems that i have to do something with the "JURI" function or the "$mosConfig_live_site" on the backlink.php file
$mosConfig_absolute_path = JPATH_SITE;
$mosConfig_live_site = JURI :: base();
$url_array = explode('/', $_SERVER['REQUEST_URI']);
Can anyone give me assistance ?
actually what the joomla does it takes the value as $_SERVER for the host so what you have to do u just append "/yaddayadda" at the email template of the joomla
You could edit:
%SITE_ROOT%/administrator/language/en-GB.com_users.ini at around LINE 28, which reads
NEW_USER_MESSAGE=Hello %s,\n\n\nYou have been added as a User to %s by an Administrator.\n\nThis e-mail contains your username and password to log in to %s\n\nUsername: %s\nPassword: %s\n\n\nPlease do not respond to this message as it is automatically generated and is for information purposes only.
Be careful with the '%s' variable as it appears to insert different values in each instance. First instance renders their NAME, second SITE NAME, third one is the USER NAME, etc, etc.
-Dennis
You can find those values in root/components/com_users/models/registration.php on line 88. It appears it pulls it out of the array that is being created their.