I am trying to send a message, using MailCore framework in iOS. This is my View Did Load method:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
myMessage = [[CTCoreMessage alloc] init];
// Set To
CTCoreAddress *addrTo = [CTCoreAddress address];
[addrTo setEmail:@"aaa@gmail.com"];
[myMessage setTo:[NSSet setWithObject:addrTo]];
// Set From
CTCoreAddress *addrFrom = [CTCoreAddress address];
[addrFrom setEmail:@"bbb@gmail.com"];
[addrFrom setName:@"bb"];
[myMessage setFrom:[NSSet setWithObject:addrFrom]];
[myMessage setSubject:@"test"];
[myMessage setHTMLBody:@"Отправил это сообщение через SMTP с TSL (используя MailCore) :)"];
[CTSMTPConnection sendMessage:myMessage server:@"smtp.gmail.com" username:@"bbbb"
password:@"ccc" port:587 useTLS:YES useAuth:YES];
[myMessage release];
}
As a result I get an e-mail, that is shortened for some reason like this:
Отправил это сообщение через SMTP с T
What could be the reason. I use gmail.com with port 587 and useTLS = YES, as you can see.
PS When I use mail.ru instead of gmail.com it's the same. Seems, it's not server problem.
This seems very suspiciously like an encoding issue. What if you HTML-escape your non-ascii characters first?
To clarify, it seems like someone is asking the HTMLBody for its length (which is in characters) and then assuming that's the right number of UTF-8 bytes to send.