Adding  around link or mail I have a custom module which prints html in hook_block_view. The text that my hook_block_view returns(in block['content']) might contain links and mail addresses.
Is there a drupal(or PHP) function that wraps the links/mail id in  ?
You can configure one of your text formats to use the "Convert URLs into links" filter, then to apply that text format to some text you can use the check_markup() function like this:

// Run text through the Filtered HTML text format.
$formatted_text = check_markup($original_text, 'filtered_html');


You can change 'filtered_html' to be whichever text format you want to apply.
Note that it will run all the other filters of that text format on the text also.