|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]|
On 20 Mar 2007, at 14:23, Marco Piovanelli wrote:
On Tue, 20 Mar 2007 07:00:40 +0000, Chris Newman (email@hidden) wrote:
Elango C wrote on 3/20/07 9:37 +0530:I would like to write a code to send the mails from my application. Can any
one help me on this...
The standard protocol for message submission is here: <http://www.apps.ietf.org/rfc/rfc4409.html>
which is based on the SMTP standard: <http://www.apps.ietf.org/rfc/rfc2821.html>
You can use CFNetwork to make the network connection if you want the ability to do more secure (SSL/TLS) submission:
CFNetwork gives you a nice abstraction layer over BSD sockets, and is easier to work with, especially in the context of a run loop-based application, but in order to submit a message to an SMTP server with CFNetwork, you still need to write a substantial amount of code.
XString response; // Contact the server XNetAddress serverAddress( "mail.improvision.com", 25 ); XNetEndpoint ep; ep.Connect( serverAddress, 30000 ); XNetStream stream( ep ); // Get our address XNetAddress ourAddress; ourAddress.SetToLocalAddress();
// Read the hello message response = stream.ReadLine();
// Initiate the message stream.WriteText( "HELO " + ourAddress.GetDescription() + "\r\n" ); response = stream.ReadLine(); stream.WriteText( "MAIL FROM: <email@hidden>\r\n" ); response = stream.ReadLine(); stream.WriteText( "RCPT TO: <email@hidden>\r\n" ); response = stream.ReadLine(); stream.WriteText( "DATA\r\n" ); response = stream.ReadLine(); // Write some general info stream.WriteText( "From: email@hidden\r\n" ); stream.WriteText( "To: email@hidden\r\n" ); stream.WriteText( "Subject: This is an e-mail\r\n" ); stream.WriteText( "\r\n" ); stream.WriteText( "Some body text\r\n" ); stream.WriteText( "\r\n" ); // Finish the message stream.WriteText( "\r\n.\r\n" ); response = stream.ReadLine(); stream.WriteText( "QUIT\r\n" ); response = stream.ReadLine();
Description: S/MIME cryptographic signature
_______________________________________________ Do not post admin requests to the list. They will be ignored. Carbon-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
|>help on SMTP (From: "Elango C" <email@hidden>)|
|>Re: help on SMTP (From: Chris Newman <email@hidden>)|
|>Re: help on SMTP (From: "Marco Piovanelli" <email@hidden>)|
Visit the Apple Store online or at retail locations.
Copyright © 2011 Apple Inc. All rights reserved.