Re: Sending Email with Attachments
Re: Sending Email with Attachments
- Subject: Re: Sending Email with Attachments
- From: Joseph Jones <email@hidden>
- Date: Fri, 24 Jan 2003 08:49:41 -0800
This look sgreat, and would be perfect except for one thing: I am not
sending a file but am attaching a generated NSMutableString (as if it wer a
file). I realize I could write the file to disk, wrap it, attach it, send it
and then delete it but that sure seems like a lot of extra work. Any ideas
on how to do this w/o having to manage an external file?
Joe
>
From: TACKEL <email@hidden>
>
Date: Fri, 24 Jan 2003 17:33:22 +0100
>
To: email@hidden, email@hidden
>
Subject: Re: Sending Email with Attachments
>
>
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.