• 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 Email with Attachments
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sending Email with Attachments


  • Subject: Re: Sending Email with Attachments
  • From: TACKEL <email@hidden>
  • Date: Fri, 24 Jan 2003 17:33:22 +0100

Hi Joseph,

After some tries that works for me:

BOOL sent;
NSFileWrapper *fw=[NSFileWrapper alloc];
NSTextAttachment *att= [NSTextAttachment alloc];


[fw initWithPath: [@"~/Desktop/file.txt" stringByExpandingTildeInPath]];
[att initWithFileWrapper:fw];



NSMutableDictionary *headers;
headers = [NSMutableDictionary dictionary];
[headers setObject:@"tackel" forKey:@"From"];
[headers setObject:@"email@hidden" forKey:@"To"];
[headers setObject:@"Report" forKey:@"Subject"];
[headers setObject:@"Apple Message" forKey:@"X-Mailer"];
[headers setObject:@"multipart/mixed" forKey:@"Content-Type"];
[headers setObject:@"1.0" forKey:@"Mime-Version"];



sent= [NSMailDelivery deliverMessage: [NSAttributedString attributedStringWithAttachment: att] headers: headers format: NSMIMEMailFormat protocol: NSSMTPDeliveryProtocol];

Hope it helps.

Regards,
Tackel.


> From: Joseph Jones <email@hidden>
> Date: Thu, 23 Jan 2003 22:21:29 -0800
> To: Cocoa Dev Dev <email@hidden>
> Subject: Sending Email with Attachments
>
> Can anyone point me to an example of sending email with attachments?
> There was a thread on sending email here a while ago, though I can;t
> seem to locate it in the archives.
>
> I have looked at EDMessage framework, and while it looks great I can
> see no way of using it with an SMTP server that requires login (like
> .Mac). I thought there was a simple way of sending mail using
> NSWorkspace, but I don't know what it was... :-(
>
> Thanx,
> joe
> _______________________________________________
> 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.

  • Follow-Ups:
    • Re: Sending Email with Attachments
      • From: Joseph Jones <email@hidden>
  • Prev by Date: Re: A good method for xml usage/parsing
  • Next by Date: Re: Old style pathname
  • Previous by thread: Sending Email with Attachments
  • Next by thread: Re: Sending Email with Attachments
  • Index(es):
    • Date
    • Thread