Description
The skpsmtpmessage is an Objective-C library that provides a simple interface for sending SMTP email messages. It is built on top of the CFNetwork framework and supports sending plain text or HTML emails with attachments.
Installation
To use the skpsmtpmessage library, follow these steps:
- Download the skpsmtpmessage library files.
- Drag and drop the library files into your Xcode project.
- Link against the CFNetwork framework.
Usage
To send an email using skpsmtpmessage, follow these steps:
- Create an instance of
SKPSMTPMessage
. - Set the various email properties such as from, to, subject, and message.
- Add attachments if necessary.
- Call the
send
method to send the email.
#import "SKPSMTPMessage.h"
...
SKPSMTPMessage *emailMessage = [[SKPSMTPMessage alloc] init];
emailMessage.fromEmail = @"your-email@example.com";
emailMessage.toEmail = @"recipient@example.com";
emailMessage.relayHost = @"smtp.example.com";
emailMessage.requiresAuth = YES;
emailMessage.login = @"your-username";
emailMessage.pass = @"your-password";
emailMessage.subject = @"Hello";
emailMessage.wantsSecure = YES;
emailMessage.delegate = self;
NSDictionary *plainPart = @{kSKPSMTPPartContentTypeKey : @"text/plain",
kSKPSMTPPartMessageKey : @"This is the plain text message."};
emailMessage.parts = @[plainPart];
if ([emailMessage send]) {
NSLog(@"Email sent successfully.");
} else {
NSLog(@"Error occurred while sending email.");
}
Additional Configuration
The skpsmtpmessage library also provides some additional configuration options:
- Set the hostname and port number of the SMTP relay host.
- Enable or disable secure connection using SSL.
- Set the authentication details if required.
- Set the delegate property to be notified of the email sending status.
Compatibility
The skpsmtpmessage library is compatible with iOS and macOS.
Documentation
For further details on how to use the skpsmtpmessage library, refer to the official GitHub repository.