• 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
Re: Sending mail with message.framework
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sending mail with message.framework


  • Subject: Re: Sending mail with message.framework
  • From: Mamdouh <email@hidden>
  • Date: Wed, 12 Jun 2002 12:57:07 +0200

Hi...

I have a question about sending mail with the Apple Message framework! A while ago you answered this to someone on the Cocoa-dev list:

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

Well, i4m having problems with using the framework for sending mail! The problem is: Nothing happens when i invoke the void that sets the hole thing going! I4m sending this mail to you directly because i think that you might help me, since you seem to have experience with using the message.framework... But its also sent to the Cocoa-Dev list, if somebody else can giove me a hint!!

I apologize if i4m mistaken!

Heres a snip of the code ive written:

-(void)sendMailOK:(id)sender {

NSMutableDictionary *headers;

NSString *ToString;
NSString *CCString;
NSString *SubjectString;

NSAttributedString *textViewMessage = [[NSAttributedString alloc] initWithString:[MDTextView string]]; //MDTextView is just a regular NSTextView, and i4m jst getting its contents here!

ToString=[[MailToField stringValue]autorelease];

CCString=[[MailCCField stringValue]autorelease];

SubjectString=[[MailSubjectField stringValue]autorelease];

headers = [NSMutableDictionary dictionary];
[headers setObject:ToString forKey:@"To"];
[headers setObject:CCString forKey:@"CC"];
[headers setObject:SubjectString forKey:@"Subject"];

[NSMailDelivery deliverMessage:textViewMessage headers:headers format:NSASCIIMailFormat protocol:nil];
[textViewMessage release];
}

When the user presses the button, a sheet comes up with these NSTextFields: MailToField, MailCCField and MailSubjectField. And then when he presses a button called "Send" it invokes the method above... But absolutely nothing happens afterwards!

I would appreciate it very much if you could help me, with finding out what i4m doing wrong here!

TIA
Mamdouh
Student/Programmer
Denmark
_______________________________________________
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.

  • Prev by Date: Re: Thoughts on CodeWarrior 8 for Cocoa programming?
  • Next by Date: Re: C++ code
  • Previous by thread: Re: newbie : init ?
  • Next by thread: Gap when expanding item in NSOutlineview
  • Index(es):
    • Date
    • Thread