Google Docs embed answering form - google-docs

I want to embed a form in an email that works both in a web browser and the gmail app, using google docs.
I have been able to embed it and use it in different browsers with the following code, but I can't use it in the app.
The problem is that I want the user to respond by ticking either Yes or No, and clicking an Accept button.
Could you please help me?
Thanks in advance
form.setRequireLogin(false);
var url = form.getPublishedUrl();
var response = UrlFetchApp.fetch(url);
var htmlBody = HtmlService.createHtmlOutput(response).getContent();
MailApp.sendEmail(responsableDirecto,
"Course request",
"",
{
name: 'Course request confirmation'+""+program+""+name,
htmlBody: htmlBody,
attachments: [documetoDatos],
});

Related

Add custom text to email body automatically when user clicks Reply button

I am parsing incoming emails to my domain using Mailslurp API and I want to get only the email body without the email signature. I struggled a lot finding out how to recognize signature from the email body but I could not find a satisfying solution till now.
Another alternative I plan to do is add a custom line to the email body like --- reply above this line --- when the receiver of my email clicks on reply button. The user can then add the reply above that line and I can easily extract the content above that line. Do I need to pass that line in the email headers while sending the email? If yes then can anyone please tell me how to pass the same?
Can someone please guide me about how to achieve this? I think this question is a possible duplicate of this question but since that question is unanswered thought of asking this again.
Any help is highly appreciated.
Maybe this the examle (at https://www.mailslurp.com/guides/extract-email-content/) helps. Perhaps adjust this for your usage.
it('can extract email content', async () => {
const mailslurp = new MailSlurp(config);
const inbox1 = await mailslurp.createInbox();
const inbox2 = await mailslurp.createInbox();
const to = [inbox2.emailAddress]
const body = "Hi there. Your code is: 123456"
await mailslurp.sendEmail(inbox1.id, { to, body })
// wait for email
const email = await mailslurp.waitController.waitForLatestEmail(inbox2.id, timeoutMillis, true)
const pattern = "code is: ([0-9]{6})"
expect(email.body).toContain("Your code is")
const result = await mailslurp.emailController.getEmailContentMatch({ pattern }, email.id)
expect(result.matches).toHaveLength(2);
expect(result.matches[0]).toEqual("code is: 123456")
expect(result.matches[1]).toEqual("123456")
// now do something with the code
})

Get All attachments of gmail compose box using inboxsdk

I am creating a chrome addon for Gmail email tracker. For which I am using InboxSDK, I want to get all attachments from current Gmail compose body and I am using the following code.
composeView.addButton({
.....
onClick: function (event) {
var cv = event.composeView;
var mail_body = cv.getHTMLContent();
});
});
As I am new to Chrome addon development as well as InboxSDK, I don't know how to get attachments from mail_body. Please, can anyone help me?
Thanks in advance.
Try input[name="attach"] + a as a selector to fetch all the composes attachments links.
From there you can go up in the DOM tree to get the root element for each attachment and do whatever you wanna do.
you could use document.querySelectorAll('input[name="attach"] + a'); for example. But that would return all the attachments links in all open compose views.
Here is an example with jquery, which then would just get the links from the given compose view.
composeView.addButton({
.....
onClick: function (event) {
var cv = event.composeView;
var mail_body = cv.getHTMLContent();
var attachment_links = $(mail_body).find('input[name="attach"] + a');
});
});

How to Send Pdf as MMS by Twilo Using Nodejs?

I have a Test Twilio Number which is capable to send SMS,MMS,Voice Call . I am Successful in sending SMS and Voice call .
I am facing a challenge to send PDF as MMS .. As per the TwilioDocs Accepted-mime-types PDF is a Supported Type.
While am trying to Send by using the Syntax :-
var accountSid = '<accountSid >';
var authToken = '<authToken>';
var client = require('twilio')(accountSid, authToken);
client.messages.create({
to: "<validnum>",
from: "<validFrom>",
body: "Test Message ",
mediaUrl: "http://docdro.id/GAak2pV"
mediaContentType:"pdf"
}, function(err, message) {
if(err){
console.log('Error Alert For Message '+JSON.stringify(err));
}else{
console.log(message.sid);
}
});
With the Above Code i can able to send JPG/PNG but PDF is being Failed by an Error:-
(Error: 30008) Unknown error. None
I have no clue Totally !! Somebody help me with a Saving Suggestion
Thanks,
Prasad.
Twilio developer evangelist here.
As Andy is pointing out in the comments, the URL to DropBox that you are using is actually pointing towards an HTML page that contains your PDF. You need the direct link to the PDF file itself, Twilio does not do any work to discover the PDF file within pages.
If you can host the file on S3, or anywhere else publicly, yourself then you will have more luck with this.

Sendgrid change href of link

I am using Nodejs with Express and I am sending an email through Sendgrid, but Sendgrid is changing the href link
var emailText = '<!DOCTYPE html><html><head><meta charset="UTF-8"></head><body>Here</body></html>'
var from_email = new helper.Email('contact#test.com');
var to_email = new helper.Email('contact#test2.com');
var subject = 'Test';
var content = new helper.Content("text/html", emailText)
var mail = new helper.Mail(from_email, subject, to_email, content);
var request = sg.emptyRequest({
method: 'POST',
path: '/v3/mail/send',
body: mail.toJSON(),
});
sg.API(request, function(error, response) {
if (error) {
console.log('Error response received');
}
console.log(response.statusCode);
console.log(response.body);
console.log(response.headers);
});
When the email arrives the following link appears:
https://u4006412.ct.sendgrid.net/wf/click?upn=rOQ9fjZGp5r0JyNfoC02LbL.....
Could someone help me solve this problem?
I believe this is caused by the URL click-tracking feature of sendgrid. It will redirect to your intended resource, but does not look pretty. You can turn it off in sendgrid, but it will disable URL tracking on all emails sent by that account. If you are integrating with a 3rd-party link-tracker such as bit.ly or have your GA on lock-down, this may not bother you.
Here's more information on the feature in sendgrid: https://sendgrid.com/docs/User_Guide/Settings/tracking.html
Turn that off and see how your emails look.
UPDATE: Whitelabeling in Sendgrid
Sendgrid also has a whitelabeling feature, allowing you to serve URLs from one of your subdomains while still tracking clicks/opens through their servers. If you are concerned about the prettiness of your links or perceived security from a UX perspective, this may be the way to go.
Check out their overview of whitelabeling and
link whitelabeling doc pages. Be sure to follow sendgrid's recommendations on domain usage in emails. This ensures a high success rate on delivery.
You can off the Sendgrid tracking for one link specifically.
To do so, You have to add clicktracking="off" before your href tag
Do it like this
<a clicktracking="off" href='https://mysite/auth/'>My Site</a>
Similar to #israa-saifullah said, you can state clicktracking="off" directly in an html link, but if you're sending through the sg api, there is a trackingSettings property that you can set on an individual message where you can specify if you want click and open-tracking enabled. clickTracking is what re-writes your URL's, and you can specify it at the HTML or Text based level. For example this disables all tracking and therefore leaves the URL's in the email untouched.
const msg = {
to: TO_ADDRESSS,
from: {
name: FROM_NAME,
email: FROM_ADDRESSS,
},
subject: SUBJECT,
text: TEXT_VERSION,
html: HTML_VERSION,
trackingSettings: {
clickTracking: {
enable: false,
enableText: false
},
openTracking: {
enable: false
}
}
This is helpful if you don't want to override tracking at the account level (in the SG Dashboard), but just for a specific use case.
Documentation here.
It is possible to change through the sendgrid settings, access the path: settingns -> tracking -> click tracking -> disabled

Check if someone likes page before submit on own website

I have a own page on my server where people can download a track of my own.
My idea is to put a like button on that page to my Facebook page. People must first hit the like button, and after that they can download the track. Probably this must fix with a form with name, e-mail and the like button that they have to click! After submit, there must be something that will check if the user realy hit the like button before they get the page with the special content (download link)
So the idea is if it is possible that there's a check that the page is liked before they can submit and get the download button!
Can someone tell me if this is possible and can someone help me with the code?
I have no other Facebook social plugins! I only want to use a like button!
You can check if someone clicks the like button using the Javascript SDK
You can either use the social plugin or the XFBML button,
Implementing the XFBML button and the Javascript SDK you can find here:
https://developers.facebook.com/docs/reference/javascript/
Then you can create an event listener that listens if an user clicks the like button:
FB.Event.subscribe('edge.create',
function(response) {
alert('You liked the URL: ' + response);
}
);
https://developers.facebook.com/docs/reference/javascript/FB.Event.subscribe/
Using this you can store if someone clicked the like button then save that to either your database or in a session and let the user download their track.
Your code would be something like this
<div id="fb-root"></div>
<div class="fb-like" data-href="http://www.stackoverflow.com" data-send="false" data-width="450" data-show-faces="true"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'YOUR_APP_ID', // App ID
channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Event.subscribe('edge.create',
function(response) {
alert('You liked the URL: ' + response);
}
);
};
// Load the SDK Asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
It is possible to do what you're asking. You may find this SO question and answer useful:
How to check if a user likes my Facebook Page or URL using Facebook's API

Resources