Home » Developing U++ » UppHub » WebMail package (POP/SMPT/IMAP)
Re: WebMail package (POP/SMPT/IMAP) [message #20844 is a reply to message #20841] |
Mon, 13 April 2009 23:57   |
Oblivion
Messages: 1215 Registered: August 2007
|
Senior Contributor |
|
|
Quote: |
What about smtp? I'll need to send a simple mail with one or two files. So I'm thinking about the more simple and fast variants. Can you help me with a simple code-snippet or advice?
It will be great, if you could show a "conversation" with the socket, it will help to realize how to send a mail with attachments successfully. And I don't know much more about MIME format, and about free tools for it, >_<.
And I'm going to search the answers myself too, yeh, of cause.
Best regards, great man, and sorry for my English,
Anton.
|
Hello Anton,
Actually, the code of this "yet-to-be-finished" (I'm sorry, I'm way too busy nowadays... I didn't have the time to finish it) class is based upon the original U++ SmtpMail class. So you should check "SMTPMail::Send()" method in Web/smtp.h. It will give you an idea about the socket "transaction" (or conversation, if you will). It works almost like my unfinished POP3Mail class.
Smtp example code should be something like this:
#ifndef _SmtpExample_SmtpExample_h
#define _SmtpExample_SmtpExample_h
#include <CtrlLib/CtrlLib.h>
#include <Web/Web.h>
using namespace Upp;
#define LAYOUTFILE <SmtpExample/SmtpExample.lay>
#include <CtrlCore/lay.h>
class SmtpExample : public WithSmtpExampleLayout<TopWindow> {
public:
typedef SmtpExample CLASSNAME;
SmtpExample();
SmtpMail smtp;
void Send();
};
SmtpExample::SmtpExample()
{
CtrlLayout(*this, "Smtp Example");
smtp.Transcript();
smtp.Subject("Smtp Example");
smtp.Port(25);
smtp.Host("smtp.host.com");
smtp.Auth("username", "password");
smtp.From("from");
smtp.To("to");
smtp.AttachFile("filename", mimetype = 0);
SendButton << THISBACK(Send);
}
void SmtpExample::Send()
{
smtp.Send();
LogConsole.Set(smtp.GetTranscript());
}
GUI_APP_MAIN
{
SmtpExample().Run();
}
But beware, this code probably won't work; because most of the servers require at least a TLS encryption/session after the first "HELO" message.
For more information on SMTP protocol you should read RFC 821 and RFC 5321.
You can read and search POP3/SMTP/MIME/TLS/SLL etc. RFC documents at:
http://www.rfc-editor.org/rfcsearch.html
I hope that this will give you an idea on where to start.
Regards.
Oblivion
Github page: https://github.com/ismail-yilmaz
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Tue, 14 April 2009 00:01] Report message to a moderator
|
|
|
 |
|
WebMail package (POP/SMPT/IMAP)
By: Oblivion on Mon, 22 September 2008 17:05
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
By: Oblivion on Mon, 22 September 2008 17:07
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
By: forlano on Mon, 22 September 2008 19:03
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
By: Oblivion on Mon, 22 September 2008 19:26
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
By: Oblivion on Mon, 22 September 2008 19:37
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
By: forlano on Mon, 22 September 2008 20:38
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
By: Oblivion on Mon, 22 September 2008 20:57
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
By: forlano on Mon, 22 September 2008 21:44
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
By: captainc on Mon, 22 September 2008 22:08
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
By: captainc on Tue, 23 September 2008 05:24
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
By: Oblivion on Wed, 24 September 2008 01:33
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
By: Sc0rch on Mon, 13 April 2009 19:41
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
By: Oblivion on Mon, 13 April 2009 23:57
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
By: Sc0rch on Wed, 15 April 2009 13:46
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
By: tojocky on Wed, 25 August 2010 09:01
|
 |
|
Re: WebMail package (POP/SMPT/IMAP)
By: Oblivion on Wed, 25 August 2010 16:53
|
Goto Forum:
Current Time: Sun Jul 20 14:19:08 CEST 2025
Total time taken to generate the page: 0.03862 seconds
|