Skip navigation.
 
mlRe: Sending Email with Attachments
FROM : Joseph Jones
DATE : Fri Jan 24 17:49:41 2003

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_removed>>
> Date: Fri, 24 Jan 2003 17:33:22 +0100
> To: <email_removed>, <email_removed>
> 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_removed>" 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_removed>>
>> Date: Thu, 23 Jan 2003 22:21:29 -0800
>> To: Cocoa Dev Dev <<email_removed>>
>> 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_removed>
>> 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_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

Related mailsAuthorDate
mlSending Email with Attachments Joseph Jones Jan 24, 07:21
mlRe: Sending Email with Attachments TACKEL Jan 24, 17:33
mlRe: Sending Email with Attachments Joseph Jones Jan 24, 17:49
mlRe: Sending Email with Attachments TACKEL Jan 24, 18:06
mlRe: Sending Email with Attachments Joseph Jones Jan 25, 00:18
mlRe: Sending Email with Attachments Joseph Jones Jan 25, 03:46
mlRe: Sending Email with Attachments Scott Anguish Jan 25, 05:44
mlFrom header and NSMailDelivery (was Re: Sending Email with Attachments) Alex Rice Feb 4, 07:51
mlRe: From header and NSMailDelivery (was Re: Sending Email with Attachments) j o a r Feb 4, 09:20