programmatically change "to" email field for the webform module - drupal-6

drupal 6 web form module allows a user to specify a "to" email address.
but how can i change that "to" email adress programmatically.
for example: i have some nodes in the drupal 6 system, each node has an email address,
when a person accesses that node (page), programm put that node's email address in a session variable, then when the person click a link on the node, the link will shows a web form.
at this point, when the person clicked submit button, i want the web form send a email to the node's email address (email address saved in a session variable).
thanks.

You need to use the mail_alter hook and change the value of $message['headers']['to'].
function myModule_mail_alter(&$message)
{
// Don't forget to check if the mail is actually a webform submission
if ( ($message['id'] == 'webform_submission') )
{
$message['headers']['to'] = $myMail;
}
}
More info

Related

Azure logic apps 'o365 connector' action 'send approval email' returning null for property 'useremailaddress'. Why?

Azure logic apps 'o365 connector' action 'send approval email' returning null for property 'useremailaddress'. Why?
The Azure logic apps documentation for the 'office 365 outlook connector' shows that the 'ApprovalEmailResponse' object returns 'SelectedOption' and 'UserEmailAddress'. I get the correct value back for 'SelectedOption' but 'UserEmailAddress' always returns 'null'.
https://learn.microsoft.com/en-us/connectors/office365/#approvalemailresponse
How do I get the --> email address <-- of the user that selects 'Approve' or 'Reject' buttons in the email? If an email is forwarded to another person I would like to know who (email address) clicked approve or reject.
***This is what I get if I use the recommended settings mentioned in the replies below. For production we want to set "Use only HTML message" and "Show confirmation dialog" both set to "yes".
After reproducing from our end, we understood that the messages which are recorded as HTML messages aren't capturing all the responses. For this, Make sure you have the below parameters set Hide HTML message to 'yes'.
RESPONSE REQUEST IN OUTLOOK
AFTER RESPONSE HAS BEEN RECORDED
UPDATED ANSWER
Logic App outlook connector:
result:
So... It looks like (in this particular action) the only way to get the email address of the person that clicks approve or reject is to not use HTML and to instead rely on using the action card, that is provided by the logic app action, in the email. With 'Hide HTML message' set to 'yes'. However... I was not able to find a way to render my custom card from the one provided in the email. As a workaround, I use markdown in the body of the action. Not great but looks the same as the HTML version I was going-for. If anyone can figure out how to edit/customize the card that is provided in the email by this specific logic app action. Please... let me and Microsoft (sarcasm) know.

Strapi: how to set disabled as default a new user registered, then enable by an administrator

how can I set "disabled user" as default configuration to any new user which register on, then send to any administrator an email saying "new user!!" and the administrator could anable the new user and send to him an email to let him know was approved
You will have to customize the register function.
To do so, you will have to use the extensions folder.
See the documentation here: https://strapi.io/documentation/3.0.0-beta.x/concepts/concepts.html#extensions
Here is the register function you will have to update: https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-users-permissions/controllers/Auth.js#L358
You will have to create ./extensions/users-permissions/controllers/Auth.js file that contains a module.exports with only the register function inside. Copy the plugin's one and paste it in the extension file we just created.
Then in you extend register function, you will have to update the params object and set the blocked key to true.
Just after this line https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-users-permissions/controllers/Auth.js#L378.
Then if you want to send an email, you can use the email plugin that provides you a way to send emails.
Here is the example of how we send confirmation email: https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-users-permissions/controllers/Auth.js#L508
Copy this line and update values to send an email to yourself with the content you want.

Using customer object information in private app

I'm currently trying to build a private app which will allow me to create a form which customers can use to update info like name, email address, etc.
I know that I can access this information in my template through the customer object:
https://help.shopify.com/themes/liquid/objects/customer
I also believe that I can send http requests through the admin api which would allow me to update a given customer object:
https://help.shopify.com/api/reference/customer#update
This is an example PUT request from that page
PUT /admin/customers/#{id}.json
{
"customer": {
"id": 207119551,
"email": "changed#email.address.com",
"note": "Customer is a great guy"
}
}
I think that in order to use this api (or at least use it securely) I need to use a private app. I found the following npm package which I would use to create the private app:
https://www.npmjs.com/package/shopify-node-api
This is an example of a PUT request from that page (I think this can be modified for customers):
var put_data = {
"product": {
"body_html": "<strong>Updated!</strong>"
}
}
Shopify.put('/admin/products/1234567.json', put_data, function(err, data, headers){
console.log(data);
});
Does anyone have any experience doing this as I'm unsure about a few things.
Will this PUT request be called when the url is loaded? So if I have an
<a> tag with href="/admin/products/1234567.json the request would load?
If so, this seems quite useless with the customer ID hardcoded in. Can I pass in the customer ID of whoever is logged in and clicking the link and use that as the last part of the request url somehow? In addition to this would it be possible to grab the form data that the user enters to use as the value for "email" or "note?
You should check out this answer shopify app proxy: send customer data or only customer ID for some pointers, discussion and links.
tl/dr; Don't rely on only the logged in customer id or you'll be opening yourself up to easy hackery.
So bascially you update the customer with the PUT you outlined in your question.
To get the id securely you:
Create a form with the customer id and make sure you have a server generated hash of that customer id to thwart bots (that's the reference post)
You post the customer data to a an app via a proxy url
You update the customer via a PUT to a constructed url.

How to pass credential from Site A to Site B without displaying credential at address bar

I have 3 site.
Site A : Just a login form.
Site B : an Icewarp webmail
Site C : Lotus domino mail
For now, i dont want include Site C in my question. It just for Site A and Site B
I want when a user login to Site A and then, automatically redirected to Site B. How do i pass the credential safely without the username and password being displayed?
My current script is below : This is the script when user login to Site A, and then passing the credential.
if ($mailhost == "icewarp")
{
Header("refresh:0;url=Site B icewarp URL/webmail/index.html?!#$pid:$credential");
exit;
}
elseif ($mailhost == "domino")
{
Header("refresh:0;url=Site C Domino URL/mail/domadmin.nsf?Login&Username=$pid&Password=$credential");
exit;
}
The system is working fine, but the problem is user credential is being displayed on address bar. How do i send user credential in alternate way?
You might want to encrypt the credentials. Probably is the only truly secure way.
You can encrypt it with: mcrypt-encrypt.
Then, decrypt with: mcrypt-decrypt
You could try and POST the values to the Domino login form as opposed to placing them in the address bar which forms a GET request.
For PHP - Three different was to make a POST request.
http://www.lornajane.net/posts/2010/three-ways-to-make-a-post-request-from-php

Retrieve GMail data through DotNetOpenId

I'm Trying to login with dotNetOpenId to GMail accounts. It works but I'm not able to retrieve any claims. I know I could retrieve email addresses or user names as well, but no claims are being returned only the ClaimedIdentifier is available. Anyone know how to retrieve this data from Gmail accounts? If you could please provide me an example of ClaimsRequest configuration I would be grateful.
Thanks
// Either you're creating this already or you can get to it in
// the LoggingIn event of the control you're using.
IAuthenticationRequest request;
// Add the AX request that says Email address is required.
var fetch = new FetchRequest();
fetch.Attributes.Add(
new AttributeRequest(WellKnownAttributes.Contact.Email, true));
request.AddExtension(fetch);
Google then authenticates the user and returns the email address, which you can get with:
var fetch = openid.Response.GetExtension<FetchResponse>();
if (fetch != null)
{
IList<string> emailAddresses = fetch.GetAttribute(
WellKnownAttributes.Contact.Email).Values;
string email = emailAddresses.Count > 0 ? emailAddresses[0] : null;
}
You can see my blog post on the subject for a bit more information. The important thing to note here is that Google will only tell you the user's email address if you mark it as required (as I have done in the above snippet). But this also means that if the user does not want to share his email address, he cannot log in at all. Sorry, that's the way Google set it up. Other Providers that people use have different behaviors, unfortunately.

Resources