AmitRaj07 / skpsmtpmessage

Automatically exported from code.google.com/p/skpsmtpmessage
0 stars 0 forks source link

Sending to multiple recipients is no supported #18

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
To add multiple recipient send replace the full case statement code on line
475 ( case kSKPSMTPWaitingFromReply: ) of SKPSMTPMessage.m to:

                case kSKPSMTPWaitingFromReply:
                {
                    if ([tmpLine hasPrefix:@"250 "])
                    {
                        sendState = kSKPSMTPWaitingToReply;

                        NSString *rcptTo;

                        // Check for multiple recipients
                        if( [toEmail rangeOfString:@";"].location != NSNotFound || [toEmail
rangeOfString:@","].location != NSNotFound )
                        {
                            NSCharacterSet *splitSet = [NSCharacterSet
characterSetWithCharactersInString:@";,"];
                            NSArray *addressParts = [toEmail
componentsSeparatedByCharactersInSet:splitSet];

                            // Filter spaces before and after entered email addres
                            NSCharacterSet *whitespaceCharSet = [NSCharacterSet
whitespaceCharacterSet];

                            NSMutableString *multipleRcptTo = [NSMutableString string];
                            for( NSString *address in addressParts )
                            {
                                [multipleRcptTo appendFormat:@"RCPT TO:<%@>\r\n", [address
stringByTrimmingCharactersInSet:whitespaceCharSet]];
                            }
                            rcptTo = multipleRcptTo;
                        }
                        else
                        {
                            rcptTo = [NSString stringWithFormat:@"RCPT TO:<%@>\r\n", toEmail];
                        }

                        NSLog(@"C: %@", rcptTo);

CFWriteStreamWriteFully((CFWriteStreamRef)outputStream, (const uint8_t
*)[rcptTo UTF8String], [rcptTo
lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
                        [self startShortWatchdog];
                    }
                    break;
                }

Original issue reported on code.google.com by mdes...@gmail.com on 18 Feb 2009 at 7:54

GoogleCodeExporter commented 9 years ago
Yes i am also facing this problem. But i can send with gmail but not able with 
Aol.

Original comment by coder4ip...@gmail.com on 27 Jul 2009 at 6:51

GoogleCodeExporter commented 9 years ago
let I have 3 email reciepients namely....a@gmail.com,b@gmail.com and 
c@gmail.com.
Can someone please tell me how should msg.toEmail=@"          "; be 
written...while configuring msg.

Where msg is an object of SKPSMTPMessage.

Original comment by danish.k...@gmail.com on 1 Jul 2013 at 7:20