• 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 using Pantomime
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Sending email using Pantomime


  • Subject: Re: Sending email using Pantomime
  • From: Ludovic Marcotte <email@hidden>
  • Date: Fri, 09 Apr 2004 13:03:56 -0400

Hi Thierry,

I would like to send email using pantomime frameworks, but i am experiencing a problem.

Here is my code :

ToRecipient *toAddress = [[ToRecipient alloc] initWithString:@"email@hidden"];
InternetAddress *fromAddress = [[InternetAddress alloc] initWithString:@"email@hidden"];
Message *messageObj = [[Message alloc] init];
SMTP *smtpObj = [[SMTP alloc] initWithName:@"smtp.server.com" port:25];
//[smtpObj authenticateWithUsername:@"thierry" password:nil mechanism:nil];

NSString *emailContents = [NSString stringWithString:@"hello world"];


[messageObj setContentType:@"TEXT/PLAIN"];
[messageObj setCharset:@"CHARSET=utf-8"];

No need to specify "charset=", just do:

[messageObj setCharset:@"utf8"];

[messageObj addToRecipients:toAddress];
[messageObj setFrom:@"CurrenciesConverter"];

-setFrom: accepts an InternetAddress instance, not a NSString instance. You rather want to do:

[messageObj setFrom: fromAddress];

[messageObj setSubject:@"CurrenciesConverter"];
[messageObj setContentFromRawSource:[emailContents dataUsingEncoding:NSUTF8StringEncoding]];

-setContentFromRawSource serves a different purpose, don't do that. Instead, let Pantomime do it for you. Just do:

[messageObj setContent: emailContents];

[snip]

The rest seems ok. HTH and thanks a lot,

Ludo
--
Live as if you were to die tomorrow.
Learn as if you were to live forever.
- Gandhi
_______________________________________________
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.


References: 
 >Sending email using Pantomime (From: Thierry Bucco <email@hidden>)

  • Prev by Date: Re: Icon and Text in NSTableView
  • Next by Date: [OT] Software Piracy
  • Previous by thread: Sending email using Pantomime
  • Next by thread: [OT] Software Piracy
  • Index(es):
    • Date
    • Thread