Xcode - Add hyperlink to email - objective-c

In some apps you can email straight from the app. I have seen Flipboard, you can email an article to a friend and inside the email is hyperlinked text like this:
Sent via Flipboard
So it directs you to the page with a click of the text. How can I do this? I do not want to add the link as part of the message body as it is very messy and ugly... I would prefer this clickable text way.
Thanks!

The MFMailComposeViewController has a method called
setMessageBody:isHTML:.
Here the important thing is isHTML.
Doing a link in HTML is quite simple : <a href=myURL>LinkName</a>.

Related

Redirect to calling application when click the button

So I just chatted to one of line(one of social media) official accounts and they send me a message then when I clicked the button "Call us" it redirected me to my default calling application on my phone and filled out their number. Does anyone know how to do the same thing ?
That is probably an example of tel protocol.
You basically make an HTML link just like any other link, but rather than the href containing an http:// link, the link format looks like this:
tel:1-123-456-7890
When the user clicks it, their operating system sends this number to their default app for handling tel protocols, which is usually a phone app.
Here's an article useful for explaining this protocol, as well as some handy information about using it in CSS:
https://css-tricks.com/the-current-state-of-telephone-links/

Telegram send message with clickable bot command

I'm writing a bot in telegram (using c#).
I want the bot to send message to a user with a list of clickable links. When user presses such a link, the client should post this command back to the bot. It should look like this (example from #pollbot):
I tried:
sendMesage method with parse_mode=HTML and tg:\ links. Problem:
telegram renders them as unsafe and navigates away from the chat. Or shows no link.
/sendMessage?chat_id=xxxxxxxx&parse_mode=HTML&text=CommandText
etc...
sendMessage with markdown - same result or no link
/sendMessage?chat_id=xxxxxxxxx&parse_mode=markdown&text=[\CommandText](\Command)
inline keyboard works OK, but I need a link, not a button
Any advice on how to implement this is higly appreciated.
Words starting with a "/" in a text are automatically made clickable as a link. You can just use sendMessage without a parse_mode and send the text /newpoll.

Passing variables? wordpress

Hello all I'm very thankful for this community here, wouldn't know what to do without you all.
First of all, I'm not even sure if the title to this post is accurate; please read on. In a nutshell what I'm trying to do in Wordpress is create a 'reply' button that will be displayed on the individual post's page. When someone clicks on this 'reply' button it will take them to a different WP page that is using a private messaging plugin. On this page I would like the 'to:' field to automatically know who to reply to (author of the post).
Now here's my question. Is this accomplished by "passing a variable" from first page to the second or is there another way to do this?
I'm not asking for specific code help so please don't tell me to go talk with the plugin developer. I'm just trying to get a general idea of how something like can be accomplished so that I can do some research myself.
At the very least, If someone get give me a starting point for me to do some google research that would be all I need. Being fairly new I don't even know what phrase I should be googling for.
Yes, you can do that by implementing simple wp plugin. First of all you need to know that, there are lots of wp specific functions. You can use the_content for putting your reply link after post content, and get_author_meta in order to get post's author email for putting it in your custom link. I know, you don't want to talk about code, but I can give you sample example; In order to apply this functionality on all post, you can simply implement a plugin.
Edit: For redirecting to Private Messaging plugin's send page with prepopulated recipient field, I have updated get_the_author_meta('email') with get_the_author_meta('user_login'). Now, you can go to mail send page, by clicking Reply link
add_filter('the_content', 'add_custom_link');
function add_custom_link($content) { // You can think that $content => individual post
if(is_single()) {
$content .= 'Reply to this post';
}
return $content;
}
Save this code in a php file and zip it.Then, upload it to your wp site as plugin. And you will see your custom link at the end of your posts. Do not forget to update variables in plugin according to your needs(for example reply url domain)
Here is a working plugin demo: http://huseyinbabal.eu01.aws.af.cm/?p=1
Create a form that posts to the secondary page.
Use a hidden form field to pass the post ID
Make sure you prefix the form fields so your $_POST variable doesn't conflict with any other core/plugin variables
On the secondary page: make sure you sanitize that user input before you do anything else
with it
use the sanitized post id to look up the post's author, without
having to expose the author's email in the url.
Your Form should look something like so:
<form action="url-of-page-2" method="POST">
<input type="hidden" name="myprefix_id" value="<?php echo get_the_ID();?>">
<input type="submit" value="reply">
</form>

Rails, emails and html code

When my rails app sends an email to a gmail account with the body as html code dynamically generated, in the email the html code is displayed and the html is not rendered.
my html is dynamically generated something like this:
html = "<html><table> ...... </table></html>"
and the email displays all of that html code
Do i need to add any specific headers or anything?
I would suggest taking a look at the Action Mailer Rails Guide. Sounds like you're only using the mailer part of Action Mailer. You should avoid hand crafting HTML into a variable like that, it's not the Rails-way.
I'd also suggest taking a look at Ryan Bate's screencast on Sending HTML Email.
Try
html.html_safe
to render the text of html as HTML type instead of plain text, or your tags will be html-escaped...

Create hyperlink to some text in NSTextView

I can create a hyperlink to some url in an NSTextView using the "Link Panel". Or I can add a link manually using the NSLinkAttributeName attribute of NSAttributedString.
I don't want to make a hyperlink to some external url though, I want to be able to create a hyperlink to some text within the NSTextView. Do you know how in Pages you can set some text as a Bookmark, and then you can make a hyperlink to that bookmark? Any ideas or examples of how to go about that?
I haven't done this in a while so take this with a grain of salt but it goes something like:
You need to define a protocol for you app to handle URLs. It will look something like "myApplicationName://aPath"
In the apps Info.plistfile add the protocol under CFBundleURLTypes key.
Write code for the app to respond to openURL from NSWorkspace. This means the app will have to understand how to convert a URL style path to a specific location in one of its documents.
I think the best method for handling the URL path is to assign a UUID to each document and then a numeric scheme to the paragraph and sentences. The URL ends up looking like: myApplicationName://UUID/paragraphNumber/sentenceNumber/wordNumber. Alternatively you can insert hidden text to define an anchor and just search for that anchor.