Re: sending mail using message framework
Re: sending mail using message framework
- Subject: Re: sending mail using message framework
- From: John Anderson <email@hidden>
- Date: Thu, 6 Jun 2002 13:44:24 -0700
The selector expects an NSAttributedString as its first parameter, not an NSString.
Perhaps try this instead:
NSMutableDictionary *headers;
NSAttributedString *attrAlertMessage = [[NSAttributedString alloc] initWithString:alertMessage];
headers = [NSMutableDictionary dictionary];
[headers setObject:@"email@hidden" forKey:@"From"];
[headers setObject:@"email@hidden" forKey:@"To"];
[headers setObject:@"test" forKey:@"Subject"];
[headers setObject:@"myApp" forKey:@"X-Mailer"];
[headers setObject:@"text/plain; charset=US-ASCII; format=flowed" forKey:@"Content-Type"];
[headers setObject:@"1.0" forKey:@"Mime-Version"];
[NSMailDelivery deliverMessage:attrAlertMessage headers:headers format:NSASCIIMailFormat protocol:nil];
[attrAlertMessage release];
John Anderson
everchanging
On Thursday, June 6, 2002, at 12:57 PM, Peter Schols wrote:
Hi,
I'm trying to get my app sending mail using Apple's message framework. It works well when using the + (BOOL)deliverMessage:(NSString *)messageBody subject:(NSString *)messageSubject to:(NSString *)destinationAddress; method.
But when using the method below, I get an error: Exception raised during message encoding: *** -[NSCFString containsAttachments]: selector not recognized
+ (BOOL)deliverMessage: (NSAttributedString *)messageBody headers: (NSDictionary *)messageHeaders format: (NSString *)messageFormat protocol: (NSString *)deliveryProtocol;
Here is what I'm doing:
NSMutableDictionary *headers;
headers = [NSMutableDictionary dictionary];
[headers setObject:@"email@hidden" forKey:@"From"];
[headers setObject:@"email@hidden" forKey:@"To"];
[headers setObject:@"test" forKey:@"Subject"];
[headers setObject:@"myApp" forKey:@"X-Mailer"];
[headers setObject:@"text/plain; charset=US-ASCII; format=flowed" forKey:@"Content-Type"];
[headers setObject:@"1.0" forKey:@"Mime-Version"];
[NSMailDelivery deliverMessage:alertMessage headers:headers format:NSASCIIMailFormat protocol:nil];
alertMessage is an NSString.
Any ideas on what's going wrong here would be appreciated!
TIA
Peter
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.