Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 651475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:09:56+00:00 2026-05-13T22:09:56+00:00

I am trying to send some text in an email from my cocoa app

  • 0

I am trying to send some text in an email from my cocoa app (by using Mail.app). Initially I tried using HTML to send properly formatted text. But the mailto: URL does not support html tags (even after setting headers)

So I decided to use formatted string (left-aligning of string) This is what I have in my mailto: link’s body argument

NSMutableString *emailBody = [NSMutableString stringWithFormat:@"|%-35s", [@"Name" UTF8String]];
[emailBody appendFormat:@"|%-18s", [@"Number" UTF8String]];
[emailBody appendString:@"|Notes\n"];

[emailBody appendString:@"----------------------------------------------------------------------------------------------------"];

for(int i = 0; i < [items count]; i++){
    NSDictionary *props = [items objectAtIndex:i];

    NSMutableString *emailData = [NSMutableString stringWithFormat:@"|%-35s", [[props valueForKey:@"name"] UTF8String]];

    [emailData appendFormat:@"|$ %-16s", [[props valueForKey:@"number"] UTF8String]];
    [emailData appendString:[props valueForKey:@"notes"]];

    [emailBody appendString:@"\n"];
    [emailBody appendString:emailData];
}

This does give me padded text but they all don’t necessarily take up the same space (for instance if there is an O in the text, it takes up more space than others and ruins the formatting)

Is there another sure-shot way to format text using just NSString?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T22:09:57+00:00Added an answer on May 13, 2026 at 10:09 pm

    No matter what content you send via a mailto: URL, its formatting will be determined by the user’s settings in Mail. The default setting uses a proportional font and aligning text with spaces when a proportional font is being used is doomed to failure. You can’t force Mail to use a monospace font via a mailto: URL. You can only send a plain string to Mail this way.

    In general, mailto: links should be used for creating only very basic email content.

    If you want to control the formatting of the email, you should create an HTML email as outlined in this answer to a previous question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to send some email in my C# app. I am behind a proxy
I am trying to send an email message with data collected from an html
I am trying to send some text from the client's end to the server.
I'm trying to nicely format some text data from database to send in emails
I am trying to send and email text or/and html versions.. What I do
I'm trying to share some text using an intent: Intent i = new Intent(android.content.Intent.ACTION_SEND);
I am currently trying to send some data from and Android application to a
I'm trying to send email with some images attached in django. Code used is
I'm trying to send a URL with some parameters using HttpPost but it has
I'm trying to send an email from my application with a PHP contact form,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.