MFMailComposeViewController : how do I embed a clickable URL link into the email message body

后端 未结 5 1463
你的背包
你的背包 2020-12-09 05:31

I want my app using the MFMailComposeViewController to send an email such that the recipient can click on the embedded url to open the correspondin

5条回答
  •  情深已故
    2020-12-09 05:41

    I deleted my previous answer as it was incorrect and irrelevant. After much hair pulling I finally figured out what was going on in my case and is probably what is happening in this question.

    When you compose the HTML body for the MFMailComposeViewController you must put line breaks in the HTML. If any line is > 76 chars long, the body will be interpreted as follows:

    Content-Type: text/html; charset=UTF-8
    Content-Transfer-Encoding: quoted-printable
    

    If you put line breaks in, the Content-Transfer-Encoding: quoted-printable will not happen and everything works as expected. Assuming you have proper HTML.

    As an example, build the body as follows:

    NSMutableString *body = [NSMutableString string];
    // add HTML before the link here with line breaks (\n)
    [body appendString:@"

    Hello User!

    \n"]; [body appendString:@"Click Me!\n"]; [body appendString:@"
    Thanks much!
    \n"];

    Cheers!

提交回复
热议问题