• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSMailDelivery and HTML Email
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSMailDelivery and HTML Email


  • Subject: NSMailDelivery and HTML Email
  • From: Aleks Tucovic <email@hidden>
  • Date: Tue, 02 Aug 2005 16:21:50 -0500

I have successfully used the NSMailDelivery to send text/plain and text/enriched emails but what seems to be lacking is support for text/ html. The message in the example is sent but Content-type always reverts to text/plain and the email message is displayed as HTML source. Has anyone had any success with text/html?

    NSAttributedString * htmlString = [NSAttributedString alloc];
    NSMutableDictionary * headers = [[NSMutableDictionary alloc] init];

[htmlString initWithString: [NSString stringWithContentsOfFile: @"index.html"]];

    [headers setObject: @"email@hidden"
                forKey: @"To"];
    [headers setObject: @"HTML Email"
                forKey: @"Subject"];
    [headers setObject: @"Sat, 30 Jul 2005 20:00:00 -0600 (MDT)"
                forKey: @"Date"];
    [headers setObject: @"text/html"
                forKey: @"Content-type"];

    BOOL sent = [NSMailDelivery deliverMessage: htmlString
                                       headers: headers
                                        format: NSMIMEMailFormat
                                      protocol: nil];

Aleks
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: CoreData - re-faulting object and removing self-observers results in messages being sent to zombie
  • Next by Date: Re: Custom NSTextField Cell
  • Previous by thread: Re: CoreData - re-faulting object and removing self-observers results in messages being sent to zombie
  • Next by thread: Cocoa Books?
  • Index(es):
    • Date
    • Thread