How to send email by simple email address using crm? - email

I'm working with Dynamics CRM 2016, I want to send an Email from crm using an email address that the user insert (the email Id is taken from a field in incident-Entity and not from crm-user) according to examples online the option is to use entityreference from another entity that will hold and get the Email address, is there a way not to use Entityreference but instead get my email address from a simple field on incident form?

You can use e-mail addresses that are not associated with e-mailaddress fields. It just requires a few steps.
In the UI navigate to Settings > System Settings > tab Email > header "Set Email form options".
Make sure setting "Allow messages with unresolved email recipients to be sent" is Yes.
Now you can use literal e-mail addresses like in this example:
var sender = new EntityCollection();
sender.Entities.Add(new Entity("activityparty")
{
["addressused"] = "me#home.test"
});
var recipients = new EntityCollection();
recipients.Entities.Add(new Entity("activityparty")
{
["addressused"] = "info#acme.test"
});
var eMail = new Entity("email")
{
["from"] = sender,
["to"] = recipients,
["subject"] = "Just a test",
["description"] = "Body of your e-mail"
};
organizationService.Create(eMail);

You can do it programmatically! You can send an email to a person who is not a Lead/Contact/Account.. The CRM will send email but it will show un resolved referenced when you open it in CRM

Update:
but instead get my email address from a simple field on incident form?
This is not possible in CRM UI. But possible using the code snippet from the blog link in comment. You have to query the textbox content and put in recipient party address.
(These two lines are for sending email to activity party email Id from associated record non-email field from CRM UI, without any code or customization for this particular scenario)
Unfortunately you cannot achieve it.
Only way is associated record.

Related

How to send multiple confirmation emails after order-process in HYBRIS?

How can I send multiple emails after order-process? In my way when I add products to cart and go to cart , I have option to choose some emails. For example before place order I want to send emails and to test#test.com, test1#test.com and test3#test.com confirmation emails. Hybris OOTB has a process for sending email to customer which you are login in storefront. ( For example lucas#lucas.com ) . So I'm with Lucas in storefront and now when I place order only Lucas#lucas.com recived an email from customerservices#hybris.com. I saw in GenerateEmailAction.java this piece of code
final List<EmailMessageModel> emails = new ArrayList<>();
emails.addAll(businessProcessModel.getEmails());
emails.add(emailMessageModel);
businessProcessModel.setEmails(emails);
getModelService().save(businessProcessModel);
so probably somehow can set multiple emails. One note, when I place order , I already have in orderProcessModel selected emails.
orderProcessModel.getOrder().getEmails()
which is Collection< String>
In OOTB Hybris email functionality does not support attachment, CC, BCC, multiple toAddress, etc. It should be OOTB, I hope it may come in the latest version.
To solve this, you have to define those custom attributes in BusinessProcessModel to stores the values and access them later in DefaultEmailGenerationService service. Also, you have to override the DefaultEmailGenerationService to support multiple toAddress.
For more details, follow hybris-support-multiple-toaddress.

google script emails multiple people with each having a different atachment

I am really new to google script (never used before)and I think I am trying to run before i can walk
I need to be able to send and email to a list of people but each person will need a different attachment, I don't have a clue.
Any ideas on where i should look?
Here's a good place to start. It's a tutorial created by google.
https://developers.google.com/apps-script/articles/sending_emails
Here's Google Apps Script Class MailApp documentation.
https://developers.google.com/apps-script/reference/mail/mail-app
Another tutorial...
https://ctrlq.org/code/20118-mandrill-send-email-google
Hope that helps you get started.
In terms of structure on your spreadsheet, you will need a column list of email address and beside each email address so unique identification of the attachment that is to be sent. You would then loop through each row of that sheet and send an email for each address.
Refer the below code to send multiple mails with different email id, subject, body and attachment. Hope this helps!
function sendEmail(){
var openSpreadSheet = SpreadsheetApp.openById("<<YOUR SPREADSHEET ID>>").getSheetByName("Sheet1");
var data = openSpreadSheet.getRange(2,1,openSpreadSheet.getLastRow()-1,4).getValues();
for(var i=0;i<data.length;i++){
MailApp.sendEmail({
to:data[i][0],
subject: data[i][1],
htmlBody: data[i][2],
attachments:[DriveApp.getFileById(data[i][3]).getBlob()]
})
}
}
This is how the spreadsheet is configured.

Send Email with attachment to a specific recipiant , using share Content WinRT

I'm using WinRT and I want to send an email with attachment to a specific recipient programatically, that means the user of the app will not write the recipient address.
I found to solutions that dont correspond to my needs.
the first one is to use mailto protocol like this :
var mailto = new Uri("mailto:?to=ratatata#gmail.com&subject=our first subject &body=as you know this is our first mail baby ");
await Windows.System.Launcher.LaunchUriAsync(mailto);
this solution allow me to specify the recipient but the mailto protocol dont support attachement.
the second one is by using Share Content , like this microsoft sample ,
https://code.msdn.microsoft.com/windowsapps/Sharing-Content-Source-App-d9bffd84
this solution allow me to attach any type of files , but the user of the app should write the email address of the recipient.
NB: any other methods using MessageEmail , and system.net.mail dont work !
Any help please !!

Change the displayname of the sender when sending mail via o365?

Is it possible to control the display name of the sender when sending mails with the office 365 OutlookServicesClient?
I.e., I want to use, say mailer#domain.com as the sender which is configured with the name some name#domain.com in office 365. But for a given mail I want the from name to instead be some other name#domain.com.
I've tried this:
Message draftMessage = new Message
{
Subject = subject,
Body = body,
ToRecipients = toRecip,
CcRecipients = ccRecip,
From = new Recipient()
{
EmailAddress = new EmailAddress() { Address = "mailer#domain.com", Name = "Some other name#domain.com" }
}
};
But the mail is still sent with the preconfigured name of some name#domain.com.
So, is what I want possible?
According to the reference documentation for the Message object, what you want to do is possible. However, logic tells me that shouldn't be possible, and furthermore, the testing I did showed me it wasn't possible (or isn't working). I will follow up on this and update this answer when I get a definitive answer, but at this time, it appears like you can't change the name of the sender (or it's broken).
UPDATE: The From property is writable. I've tested this using pure REST, so I can't speak exactly to what the client library you are using is doing, but I think the request is being transformed to prevent spoofing.
It is possible to control the display name of the sender, but you can only do so with other users in your Office 365 tenant. To do this, sign in to the Office 365 Admin Portal, go to Users, then Active Users, then select the user (User A) that you want to send on behalf of. Click Edit and select Mailbox Permissions. Add the alias or email address of the user (User B) who is running the code (the user authenticated with your app) to the first box under Send email from this mailbox. This will allow you to set the From property of a message sent by User B as User A.
I understand this isn't exactly what you were after, but having the ability to send email as any email address can lead to some bad stuff. Hope this helped!

Drupal Webform email receipt

I'm trying to set up an email receipt to send to the user who fills out the form.
I'm using Webform 6.x-3.1. On this help page for Webform "admin/help/webform" it hints at that function by stating this "Once finished adding fields, you may want to send e-mails to administrators or back to the user who filled out the form. Click on the Emails sub-tab underneath the Webform tab on the piece of content."
It looks like they took out the "Additional processing" ability with this version.
I tried adding an hidden email field under the "E-mails" tab to send an email to the form submitter but didn't work. What I di was add a hidden field called "email_user" and for the default value, gave it %post[email] because the email field they fill out is "email". It doesn't look like it's grabbing the post.
Does anyone have this working or understand how to get it done?
I think you might be misunderstanding the E-mails subtab. For an example, start fresh with a new Webform node and try this:
In the "Form components" subtab, add three components: "Example First Name" (type: textfield), "Example Last Name" (type: textfield), and "Example Email Address" (type: email). For this example, mark them all as "Mandatory" (although I don't think that setting is required for confirmation emails).
Check out the "E-mails" subtab. See how the "Component value:" dropdown now displays "Example Email Address" as an option? Leave that selected, and click on the "Add" button to the right.
On the next page, you can define the email header and body, as I'm sure you've seen before. Note at the top, however, the E-mail to address: field, which still has your "Example Email Address" component selected. This means that the confirmation email will be sent to the email address that is entered in the Example Email Address form field upon submission.
Now click the "View" tab and try out your form: Enter an example name and a real email address, submit, and check to see if you receive the Webform-generated confirmation email.
In short: you don't use the E-mails subtab to define additional fields/components for your form; you use it to select which existing form field(s) should be the recipient of a confirmation email.