Include quoted original message in mailto link body - email

I'm generating mailto links in support emails to make it easier to reply to customers directly from within Gmail. A typical mailto link might look like this:
mailto:customer#example.com?subject=Re%3A%20Feedback%20%20%20%5B1620394320%5D&body=%0A%0A%3E%20Original%20message%20from%20customer%40example.com%2C%202021-05-07%3A%0A%3E%20Customer%20message%20here
This works, except the original message is interpreted literally, even though the lines start with > (which I had expected to be interpreted as a quote of a previous message).
So the reply email would literally look like this for the customer:
> Original message from customer#example.com, 2021-05-07:
> Customer message here
What I want is for the lines starting with > to be treated as a quote of the original message, just like when replying to an email from any email client.
Is it possible to make Gmail do this with a body included in a mailto link?

Related

Apps Script is adding line breaks to email bodies

I am generating emails with Google Apps Script and the emails are being sent with line breaks in weird places.
Here is my code
function sendEmail(){
var name = "MyName"
var body = name + " has issued a challenge. You already have a match currently scheduled so you have the option to decline. Reply to this email with the word 'ACCEPT' or 'DECLINE' in the subject." +
"\n\nNOTE: If you do not respond to this email you will automatically accept the challenge and be responsible for scheduling the match within two weeks or suffer a forfeit."
GmailApp.sendEmail("MyEmail#gmail.com", "You've been challenged!", body)
}
You'll notice that it is also putting the text of the first section of the body in a purple color. I also don't know why this is happening but my priority is to stop the line breaks from being put where they shouldn't be.
Google 'Stacks' emails. Say for example I send you an email. Then you reply and I reply again. It stacks them all into one line in your inbox.
Any identical paragraphs in the emails are made purple. Only you see the purple.
If you delete all of the emails out of your inbox and test again, you should notice it in black.
Also, you have code to create two new lines. '\n' x2. You're essentially creating a new paragraph, do you just want a new line to begin instead? If so delete 1x '\n'. Sorry if I'm not understanding your issue.
If you were to insert the body as html and use paragraph tags you would likely be able to achieve the results you are pursuing.
I am on mobile and don't know how to get resource links to prove the above sorry.
Edit: I would make the following change:
body = name + " has issued a challenge. You already have a match currently scheduled so you have the option to decline. Reply to this email with the word 'ACCEPT' or 'DECLINE' in the subject." + "\n\n" + "NOTE: If you do not respond to this email you will automatically accept the challenge and be responsible for scheduling the match within two weeks or suffer a forfeit."
Your code is including the body as plain text so it is automatically cropped at certain line length. Below some questions about the same "problem"
Gmail API - plaintext word wrapping
Why isn't Gmail using quoted-printable encoding?
If you want to have more control about how the message content looks on Gmail, besides sending the content as plain text sent it as HTML. For doing this use
sendemail(recipient,subject,body,options)
Related questions about using the above method:
Sending an email in HTML and plain with a Gmail Apps Script

Links have random characters prepended in email

I am using the current link in my email.
*|baseUrl|*/verifyEmail?token=*|token|*
This however causes one or two people to get strange links from the email and get not found, usually based on some random email providers. E.g. - if I use a 10 minute mail (10minutemail.com), I get the following:
https://10minutemail.com/10MinuteMail/www.mywebsite.com/verifyEmail?token=b32fee82da59e7b4085269faca35ec7025122876
Correct link: www.mywebsite.com/verifyEmail?token=b32fee82da59e7b4085269faca35ec7025122876
Assuming this is due to baseUrl? Am I doing something fundamentally wrong when setting up my email link?
You need to include http:// or https:// with your baseUrl. Otherwise the email client may prepend a default base address instead of 'just' the missing protocol, especially if it is a webmail client.

How to get the received email with spaces in CAKEPHP?

In my cakephp website i have a controller which handles a simple contact form. But i have a problem! If in the contact_controller.php code i use:
$this->Email->send($this->data['Contact']['message']);
i receive the email in my mail box with linebreaks like the user wrote the message. But if i use:
$this->Email->send();
and create an html template to get the variables that i want to receive in mail, i will receive the same with no linebreaks.
How i can fix that?
Which one do you want? In the first case you send a plain text email, so you will have your line breaks in place.
In the second place you send HTML e-mail, where line breaks are in place, but simply ignored.
So either keep sending mails plain text or use nl2br() function on the body for html output.

Some email recipients get messages with =0D or =3D characters

I have a LAMP web application that emails users. Some users have complained that instead of seeing html email messages, they see weird sequences of characters such as =0D or =3D. I can't reproduce this bug with any of my email clients : gmail, yahoo mail, hotmail, thunderbird, blackberry or iphone. Does anyone know what's going on and how to fix this?
This is called quoted printable encoding. Some system that handles the mail while it is being delivered to the recipients that are seeing the offending characters messes up the encoding or the header information about the encoding.
Check whether the encoding you are setting when sending the mail matches what you are writing to the mail and whether that is also what is received by other people.
When you see something like =3D, what you're seeing is a single character in what's called "quoted-printable" encoding. "=3D" is, in fact, an equal sign. =0D is a Carriage Return (CR), =0A is a Line Feed (LF)
Taken from Not all 'plain-text' is created equal...
The link will provide an in-depth detailed description as to what is going on.

Embed indentifier within an Email

I am trying to embed an ID into an email so that when a recipient replies to an email that my system sends out, my system can pick it up and match the two together.
I have tried appending a custom header, however this is stripped out when the user replies.
I have tried embedding an HTML comment within the email, but outlook does not seem to keep comments when a reply email is created.
Worst case scenario, I can manually try and match the sent and received emails by time span or have a visible tag within the message body.
Does anyone know of a more elegant solution?
Thanks in advance
Email messages already contain such an identifiers, called Message-ID. And there's even a way to send which message you're replying to by sending that ID in a header called In-Reply-To. That's done by pretty much all email clients, that's how they usually do their threading.
It's defined in RFC 822 (yep that's pretty old) and probably re-defined and refined in more modern versions of that.
I have seen a method that includes a one byte image with a unique name that's linked to the user. When they view the email and download the images, your HTTP server will record a hit for that unique image. Of course the user needs to display images, but you can include a message in the body asking them to display the images. We actually include content in an image so they need to show images.
If your incoming e-mail can handle +foo or -foo suffixes, use that.
Many e-mail systems can route user+foo#example.com or user-foo#example.com
to user#example.com. You can replace foo with some kind of identifier.
Several mailing list servers use this for tracking bounces.
While I can't say for certain, my investigation in that sort of matter some time ago yielded the following "conclusion":
Headers are transformed a lot
Message bodies are transformed a lot
This is partly because, I suspect, of:
Need to protect users from malicious intentions
Need to perform "targeted marketing"
I have seen "unique codes" flying around in clear text in the email body but I would suggest having a unique identifier embedded in the return address instead.
The usual approach is to place the id in the subject line and/or somewhere visible in the message text and informing the recipient that he should not modify the subject or quote the original mail when responding.