jetseven / skpsmtpmessage Goto Github PK
View Code? Open in Web Editor NEWQuick SMTP client code for the iPhone
Quick SMTP client code for the iPhone
Please update Coocapod with the UTF-8 version.
Thank you.
I use fromEmail Setting sendEmailName , return error: 440 mail from account doesnt conform with authentication or S: 500 Error: bad syntax 。 Excuse me everybody. Are there any good solutions。
in the method -[SKPSMTPMessage stream:handleEvent:]
the follow codes:
NSString *tmpStr = [[NSString alloc] initWithBytes:buf length:len encoding:NSUTF8StringEncoding]; [inputString appendString:tmpStr];
when tmpStr == nil, app crashed.
please add code if (tmpStr != nil)
in next version.
Crashed Thread
0 libobjc.A.dylib 0x39fe1b26 objc_msgSend + 6
1 Shelfie 0x00398f19 -SKPSMTPMessage parseBuffer
2 Shelfie 0x00398533 -SKPSMTPMessage stream:handleEvent:
3 CoreFoundation 0x2fbe891b _signalEventSync + 116
4 CoreFoundation 0x2fbf1eed _cfstream_solo_signalEventSync + 194
5 CoreFoundation 0x2fbe85cd _CFStreamSignalEvent + 326
6 CFNetwork 0x2f84b77f _ZN29CoreReadStreamCFStreamSupport19coreStreamReadEventEP16__CoreReadStreamm + 72
7 CFNetwork 0x2f84b729 _ZN20CoreReadStreamClient25coreStreamEventsAvailableEm + 34
8 CFNetwork 0x2f8f2113 _ZN14CoreStreamBase14_callClientNowEP16CoreStreamClient + 40
9 CFNetwork 0x2f84b4cf _ZN14CoreStreamBase34_streamSetEventAndScheduleDeliveryEmh + 120
10 CFNetwork 0x2f84b37b _ZN14CoreStreamBase28_streamInterface_SignalEventEmPK13CFStreamError + 32
11 CFNetwork 0x2f84b317 _ZN12SocketStream40dispatchSignalFromSocketCallbackUnlockedEP24SocketStreamSignalHolder + 52
12 CFNetwork 0x2f84adb9 _ZN12SocketStream14socketCallbackEP10__CFSocketmPK8__CFDataPKv + 142
13 CFNetwork 0x2f84acf3 _ZN12SocketStream22_SocketCallBack_streamEP10__CFSocketmPK8__CFDataPKvPv + 56
14 CoreFoundation 0x2fc24337 __CFSocketPerformV0 + 576
15 CoreFoundation 0x2fc22183 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 12
16 CoreFoundation 0x2fc21653 __CFRunLoopDoSources0 + 204
17 CoreFoundation 0x2fc1fe47 __CFRunLoopRun + 620
18 CoreFoundation 0x2fb8ac27 CFRunLoopRunSpecific + 520
19 CoreFoundation 0x2fb8aa0b CFRunLoopRunInMode + 104
20 GraphicsServices 0x34869283 GSEventRunModal + 136
21 UIKit 0x3242e049 UIApplicationMain + 1134
22 Shelfie 0x00059b8d main (main.m:16)
23 libdyld.dylib 0x3a4eeab7 start + 0
Skip to register data
8 other threads
Thread: Unknown Name
0 libsystem_kernel.dylib 0x3a59283c kevent64 + 24
1 libdispatch.dylib 0x3a4cd3a3 _dispatch_mgr_thread$VARIANT$up + 36
Thread: Unknown Name
0 libsystem_kernel.dylib 0x3a5a5c7c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x3a60bc84 start_wqthread + 6
Thread: Unknown Name
0 libsystem_kernel.dylib 0x3a5a5c7c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x3a60bc84 start_wqthread + 6
Thread: Unknown Name
0 libsystem_kernel.dylib 0x3a592a8c mach_msg_trap + 20
1 CoreFoundation 0x2fc217c3 CFRunLoopServiceMachPort + 152
2 CoreFoundation 0x2fc1fee9 __CFRunLoopRun + 782
3 CoreFoundation 0x2fb8ac27 CFRunLoopRunSpecific + 520
4 CoreFoundation 0x2fb8aa0b CFRunLoopRunInMode + 104
5 Foundation 0x305783db -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 252
6 Foundation 0x305c9311 -[NSRunLoop(NSRunLoop) run] + 78
7 Shelfie 0x002ea871 +[GAI threadMain:] + 62
8 Foundation 0x3063ac87 __NSThread__main + 1060
9 libsystem_pthread.dylib 0x3a60dc1d _pthread_body + 138
10 libsystem_pthread.dylib 0x3a60db8f _pthread_start + 100
11 libsystem_pthread.dylib 0x3a60bc90 thread_start + 6
Thread: Unknown Name
0 libsystem_kernel.dylib 0x3a592a8c mach_msg_trap + 20
1 CoreFoundation 0x2fc217c3 CFRunLoopServiceMachPort + 152
2 CoreFoundation 0x2fc1fee9 __CFRunLoopRun + 782
3 CoreFoundation 0x2fb8ac27 CFRunLoopRunSpecific + 520
4 CoreFoundation 0x2fb8aa0b CFRunLoopRunInMode + 104
5 Foundation 0x305783db -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 252
6 Foundation 0x305c9311 -[NSRunLoop(NSRunLoop) run] + 78
7 Shelfie 0x003564ef +AFURLConnectionOperation networkRequestThreadEntryPoint:
8 Foundation 0x3063ac87 __NSThread__main + 1060
9 libsystem_pthread.dylib 0x3a60dc1d _pthread_body + 138
10 libsystem_pthread.dylib 0x3a60db8f _pthread_start + 100
11 libsystem_pthread.dylib 0x3a60bc90 thread_start + 6
Thread: Unknown Name
0 libsystem_kernel.dylib 0x3a592a8c mach_msg_trap + 20
1 CoreFoundation 0x2fc217c3 CFRunLoopServiceMachPort + 152
2 CoreFoundation 0x2fc1fee9 __CFRunLoopRun + 782
3 CoreFoundation 0x2fb8ac27 CFRunLoopRunSpecific + 520
4 CoreFoundation 0x2fb8aa0b CFRunLoopRunInMode + 104
5 Foundation 0x305c52f7 +[NSURLConnection(Loader) _resourceLoadLoop:] + 316
6 Foundation 0x3063ac87 __NSThread__main + 1060
7 libsystem_pthread.dylib 0x3a60dc1d _pthread_body + 138
8 libsystem_pthread.dylib 0x3a60db8f _pthread_start + 100
9 libsystem_pthread.dylib 0x3a60bc90 thread_start + 6
Thread: Unknown Name
0 libsystem_kernel.dylib 0x3a5a4f70 __psynch_mutexdrop + 24
1 CoreFoundation 0x2fb89eeb CFRunLoopWakeUp + 140
2 CoreFoundation 0x2fc25ffd __CFSocketManager + 2906
3 libsystem_pthread.dylib 0x3a60dc1d _pthread_body + 138
4 libsystem_pthread.dylib 0x3a60db8f _pthread_start + 100
5 libsystem_pthread.dylib 0x3a60bc90 thread_start + 6
Thread: Unknown Name
0 libsystem_kernel.dylib 0x3a5a5c7c __workq_kernreturn + 8
1 libsystem_pthread.dylib 0x3a60bc84 start_wqthread + 6
Register data from crashed thread
r0: 0x19093a80 r1: 0x4082c9 r2: 0x0 r3: 0x39fe1b21
r4: 0x19093a80 r5: 0x39fe1b21 r6: 0x46f300 r7: 0x27dda018
r8: 0x27dda88c r9: 0xc0000000 r10: 0x39fe1b21 r11: 0x3a8abfe4
sp: 0x27dd9ff4 lr: 0x396ca3 pc: 0x39fe1b26 cpsr: 0x60000030
I used exchange sever to send email but it always failed to connect the sever, I set the parameters as follows
SKPSMTPMessage *message = [[SKPSMTPMessage alloc] init];
message.fromEmail = account.email;
message.toEmail = @"[email protected]";
message.requiresAuth = YES;
message.wantsSecure = YES;
message.subject = @"test";
message.delegate = self;
message.relayHost = @"exchange.com";
message.login = account.username;
message.pass = account.password;
I sent some file with Chinese title, when download the file the title is garbled, I can't solve it, Could
you give me some suggest ?
when stopWatchdog,often crash in "self.watchdogTimer = nil;"
When messageSent , often crash in method "CFWriteStreamWriteFully(CFWriteStreamRef outputStream, const uint8_t* buffer, CFIndex length)", class is HSK_CFUtilities, in this sentence "if (CFWriteStreamCanAcceptBytes(outputStream))"
I can't solve this problem.
Hope to help me,thanks
NSDate *now = [[NSDate alloc] init];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"EEE, dd MMM yyyy HH:mm:ss Z"];
dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US"];//加入这一句代码
I just noticed an error when you're sending mails with 3G or lower bandwidths.
Everytime I get the following error:
[SKPSMTPMessage setWatchdogTimer:]: message sent to deallocated instance 0x1edd59e0
This error occurs in SKPSMTPMessage.m :
- (void)stopWatchdog
{
NSLog(@"*** stopping watchdog ***");
[self.watchdogTimer invalidate];
self.watchdogTimer = nil; // -> here it crashes!!!!!
}
I'm trying to send a various number of mails in a row. But it also crashes when I just send 2 mails.
Any idea how to fix this?
I'm using below code for sending excel fie which exists on Document directory But It's not working. Need suggestion urgently. Excel File extension .xlsx.
NSData *data=[NSData dataWithContentsOfFile:filePath];
NSDictionary *excelFileDict = [NSDictionary dictionaryWithObjectsAndKeys:@"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",kSKPSMTPPartContentTypeKey,
data, kSKPSMTPPartMessageKey,@"8bit",kSKPSMTPPartContentTransferEncodingKey,nil];
testMsg.parts = [NSArray arrayWithObjects:excelFileDict,nil];
If a mail was delivered with Asian words(coding with utf-8),I have to check it in utf-8 otherwise I wil get unrecognizable characters.
So I think if I just use Unicode to code my mail content , It will be OK.
Does anybody have a sulotion?Aappreciate!
original issue here: http://code.google.com/p/skpsmtpmessage/issues/detail?id=57
And change this will be ok.
in SKPSMTPMessage.m
you can search it
// NSData *messageData = [message dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSData *messageData = [message dataUsingEncoding:NSUTF8StringEncoding allowLossyConversion:YES];
Hi nice library. I have a question. When I attach zip form gmail using web site and send it to Rackspace everything works good.
But when I attached data using you library, then I can unzip file
I also created question here:
http://stackoverflow.com/questions/25663638/rackspce-compressed-zipped-folders-error
SKPSMTPMessage *test_smtp_message = [[SKPSMTPMessage alloc] init];
test_smtp_message.email_id = email.email_id;
test_smtp_message.delegate = self;
test_smtp_message.fromEmail = @"email here";
test_smtp_message.toEmail = @"email here";
test_smtp_message.relayHost = @"";
test_smtp_message.requiresAuth = YES;
test_smtp_message.login = @"login here";
test_smtp_message.pass = @"password here";
test_smtp_message.wantsSecure = YES; // smtp.gmail.com doesn't work without TLS!
test_smtp_message.subject = @"TEST";
// test_smtp_message.validateSSLChain = NO; // Only do this for self-signed certs!
NSMutableArray *parts_to_send = [NSMutableArray array];
NSString *plainText = [self plainText:email];
NSDictionary *plainPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/plain",
kSKPSMTPPartContentTypeKey,
plainText,
kSKPSMTPPartMessageKey,
@"8bit",
kSKPSMTPPartContentTransferEncodingKey,
nil];
[parts_to_send addObject:plainPart];
NSString *zipName = [NSString stringWithFormat:@"%@.zip", email.email_id];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:zipName];
filePath = @"/Users/Alex/Library/Application Support/iPhone Simulator/7.1/Applications/D5D29C45-F2C0-4352-9102-FA59CA6B6E83/Documents/archivename.zip";
NSData *image_data = [NSData dataWithContentsOfFile:filePath];
NSDictionary *vcfPart = [NSDictionary dictionaryWithObjectsAndKeys:@"text/directory;\r\n\tx-unix-mode=0644;\r\n\tname=\"doc.zip\"",kSKPSMTPPartContentTypeKey,
@"attachment;\r\n\tfilename=\"doc.zip\"",kSKPSMTPPartContentDispositionKey,[image_data encodeBase64ForData],kSKPSMTPPartMessageKey,@"base64",kSKPSMTPPartContentTransferEncodingKey,nil];
[parts_to_send addObject:vcfPart];
test_smtp_message.parts = parts_to_send;
// Set core data object SAPEmail to state composing
//HighestState = 0;
[test_smtp_message send];
NSDictionary *params = @{kEmail_id: email.email_id,
kStatus: @(EmailStatusInProgress)};
[SAPCoreDataEmailHelper setEmailWithParams:params withSuccess:nil];
Is this possible to make cancelation of sending email while it is in progress?
Or maybe this is enough just release object?
Please add semantic version tags.
I’ve recently added <skpsmtpmessage>
to the CocoaPods package manager repo. I am waiting for the pull request to be approved by the Cocoapods team.
CocoaPods is a tool for managing dependencies for OS X and iOS Xcode projects and provides a central repository for iOS/OS X libraries. This makes adding libraries to a project and updating them extremely easy and it will help users to resolve dependencies of the libraries they use.
However, <skpsmtpmessage>
doesn't have any version tags. I’ve added the current HEAD as version 0.0.1, but a version tag will make dependency resolution much easier.
Semantic version tags (instead of plain commit hashes/revisions) allow for resolution of cross-dependencies.
In case you didn’t know this yet; you can tag the current HEAD as, for instance, version 1.0.0, like so:
$ git tag -a 1.0.0 -m "Tag release 1.0.0"
$ git push --tags
can not send message with "Attempting to connect to server at: smtp.163.com:25"
Can you please tell me, how to change messageBody in swift? I used gides in the internet, but they all written in obj-c, when i convert it to swift, i have problems
2021-01-28 15:58:21.252830+0800 用户端Demo[10183:3119213] S: 250 8BITMIME
2021-01-28 15:58:21.253096+0800 用户端Demo[10183:3119213] C: AUTH PLAIN AGF5YW5nY29vbDEwMEAxNjMuY29tAE1ITEhVT1BKVFZIUFBCT0g=
2021-01-28 15:58:21.287326+0800 用户端Demo[10183:3119213] ~~~~
235 Authentication successful
2021-01-28 15:58:21.287554+0800 用户端Demo[10183:3119213] S: 235 Authentication successful
2021-01-28 15:58:21.299214+0800 用户端Demo[10183:3119213] ~~~~
250 Mail OK
2021-01-28 15:58:21.299433+0800 用户端Demo[10183:3119213] S: 250 Mail OK
2021-01-28 15:58:21.309208+0800 用户端Demo[10183:3119213] ~~~~
250 Mail OK
2021-01-28 15:58:21.309415+0800 用户端Demo[10183:3119213] S: 250 Mail OK
2021-01-28 15:58:21.342167+0800 用户端Demo[10183:3119213] ~~~~
354 End data with .
2021-01-28 15:58:21.342375+0800 用户端Demo[10183:3119213] S: 354 End data with .
2021-01-28 15:58:21.609725+0800 用户端Demo[10183:3119213] ~~~~
421 Read data from client error
2021-01-28 15:58:21.609885+0800 用户端Demo[10183:3119213] S: 421 Read data from client error
2021-01-28 15:58:23.842890+0800 用户端Demo[10183:3119213] SocketStream read error [0x2834c61b0]: 1 54
2021-01-28 15:58:23.843495+0800 用户端Demo[10183:3119213] ~~~~
2021-01-28 15:58:23.843956+0800 用户端Demo[10183:3119213] S:
when use GPRS to send a mail ,some time it will out this error:kSKPSMTPErrorConnectionInterrupted.
"The connection to the server was interrupted.", @"server connection interrupted error description"
then app crash . but other error won't have this problem.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.