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.
Related
I am able to open a new work item every time I receive an email with specific words in the subject.
I want to add the email itself to the work item as attachment. I have no clue how to do that.
The flow looks like this one (I cannot expand for privacy):
Any suggestion?
P.S. I searched online before posting this question but no result was promising....
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.
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 !!
I'm testing email sent from Google Apps Script and it's sending it with the display name of the email address (the part before the #).
It's a business address like: info#example.com and all that is showing is "info".
I would like to make it like: "Bob from Example.com"
Is there any way to do this in App Script? I have it set up for manually sent emails.
Thanks in advance. I couldn't find help from a Google search.
Yes, you could do that with the advanced parameters of sendEmail method of GmailApp class.
name is the parameter you are looking for.
Here is the code sample that Google provides.
MailApp.sendEmail('mike#example.com', 'Attachment example', 'Two files are attached.', {
name: 'Automatic Emailer Script',
attachments: [file.getAs(MimeType.PDF), blob]
});
Find more details here - https://developers.google.com/apps-script/reference/mail/mail-app#sendEmail(String,String,String,Object)
I am using the latest Joomla build for my website.
Allso we use a DNS record for having the mail delivered to our own server instead of the server on which the website is hosted.
I have used several contact form components, but every sent mail goes to my SPAM folder.
After searching hours on the web (and getting linked to this site frequently) i decided to make a new post.
It does not matter if i use the standard joomla forms, or any component.
Whenever a user fills in a form on my website, the email gets sent. The user receives a copy of its message, and i receive the message of the user. However, this message gets thrown in the spam folder, as phishing.
The sender of the mail always is: username#nameserver.i3d.net; namens; websitename
What do i have to change/enable/disable for this to work?
Thanks in advance.
Patrick.
(Sorry, I'm new to Joomla, but it uses PHP, so this may apply. Also this answer got a little long...)
It might be an issue with the email headers. A lot of email clients will automatically spam-box all mail where the address in the From: header doesn't match the envelope sender. As an analogy, you might not trust a snail-mail letter signed "Your Rich Uncle", mailed in an envelope with a Nigerian return address. Also if your envelope sender has a different domain than the one the email is actually sent from, that's another quick ticket to the junk bin. For more info about Gmail's message blocking policies (and general good practices), you can try this help page.
Here's some basic PHP email-sending code:
$to = $userEmailAddress;
$subj = $emailSubject;
$mesg = $emailMessage;
$headers = implode("\r\n",array(
"MIME-Version: 1.0"
,"Content-type: text/html;charset=iso-8859-1"
,"From: WEB_ADMIN_NICE_NAME <WEB_ADMIN#YOURSERVER.COM>" // *** 'From:' header
));
$from = "-fWEB_ADMIN#YOURSERVER.COM"; // *** envelope sender
if(!mail($to, $subj, $text, $headers, $from)){
//Some error handling...
}
On the first line I commented, you'll want to replace WEB_ADMIN_NICE_NAME with the name you want the email recipient to see (e.g. "Bill Gates"), and on both lines, replace WEB_ADMIN#YOURSERVER.COM with the actual return address (e.g. "da_boss#microsoft.com"). Note: whatever address you choose for the return address is where users' replies will be sent.
To reiterate, make sure both lines have the same return address (though the nice name can be anything you like), and make sure that the actual server sending the mail is in fact located at YOURSERVER.COM.
Lastly, I'm not sure where Joomla does its mailing, but if you're totally lost, you can try grepping with -lr for 'mail[[:space:]]*('.
there are several reasons that could make your email look suspicious to spam filters; to find out which head on to:
http://www.mail-tester.com
grab the email address and send an email from your website to it.
Then go back to the page and it will tell you what's wrong.
btw I'm struggling with the same issue,my problem being that on Joomla 2.5.9 apparently when you send html emails, a text-only copy is not added to the message, which is considered "spammish behaviour"
The problem is the i3d.net email address. My personal experience is that their network (31.204.154.0 - 31.204.155.255) is a significant source of spam and they do not action abuse reports. I suggest changing your hosting company.