How to extract the email from email body using applescript? - email

I want to get the email address that i mention in the image.The email i received from my clients and i am using applescripting and
i want to use that email as recipient.I will send auto mail to this email address.
Thank You.

The concrete solution depends strongly on the HTML text.
You got two options:
Get the source of the message, extract the HTML part, use an HTML parser to get the address or convert the HTML text to plain text with textutil.
Get the content of the message – which is plain text – check all paragraphs for email parts and use regex or sed or text item delimiters to extract the address.

Related

Include quoted original message in mailto link body

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?

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

How to set email format plain text using mailto function

i am read a email using Web-methods services and facing problem, Web-methods reading HTML format email as a plain text and giving us HTML. so, i like to set content type as plain text through mail-to function. and i am using this syntax but not working:
mailto:xxxxxxx#sapient.com?Content-type=text/plain"
problem solved, solution: we can add a property on exchange server for particular email id that this email id will get email in text/plain form only. so now i am sending a HTML email then exchange server convert it as a plain text email.

Display NSString as HTML text - show string as a link

I have a string wherein there may a phone number, mail address, web address, an email address or it may be some plain text. For example: my phone number is 8009000300.
Firstly, how to display this string as HTML text?
Secondly, if displayed as HTML text, will/can 8009000300 (or web address or mail address or email address) be displayed as a link? I am going for this approach as NIAttributedLabel didn't work for me.
Note: Phone number (or other special strings) may be there in between the complete string or at the start/end of string.
You can use UITextView for displaying text and set the dataDetectorTypes property to UIDataDetectorTypeLink,UIDataDetectorTypePhoneNumber according to your requirement.
You can use CoreText, or try OHAttributedLabel or TTTAttributedLabel.

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.