Rank: Newbie
Groups: Registered
Joined: 11/8/2013(UTC)
Posts: 2
Location: Buenos Aires
I have in my hotmail folder "download" with sending mail rules content to this. As I can with Delphi, download attach the email I'm sending to the folder "download". Maybe using IMAP? Code:
procedure TForm1.Button1Click(Sender: TObject);
Var
oMail: IMail;
oClient: TMailClient;
oServer: TMailServer;
oTools: TTools;
infos: OleVariant;
folders: OleVariant; oFolder: IImap4Folder;
i, UBound, Count, iFol: Integer;
oInfo: IMailInfo;
mailFolder: WideString;
fileName: WideString;
Begin
Try
oTools := TTools.Create(Application);
// Create a folder named "inbox" under
// current directory to store the email files
mailFolder := GetCurrentDir() + '\inbox';
oTools.CreateFolder(mailFolder);
oServer := TMailServer.Create(Application);
oServer.User := 'user@outlook.com';
oServer.Password := 'password';
oServer.Server := 'imap-mail.outlook.com';
oServer.Protocol := MailServerImap4;
oServer.Port := 993;
oServer.SSLType := ConnectSSL;
oClient := TMailClient.Create(Application);
oClient.LicenseCode := 'TryIt';
oClient.Connect1(oServer.DefaultInterface);
self.Caption := 'Connected!';
//GetFolders
folders := oClient.Imap4Folders;
iFol := VarArrayHighBound( folders, 1 );
Memo1.Clear;
For i := 0 To iFol Do Begin
oFolder := IDispatch(VarArrayGet(infos, i)) As IImap4Folder ;
Memo1.Lines.Add(oFolder.Name);
End;
infos := oClient.GetMailInfos();
UBound := VarArrayHighBound( infos, 1 );
Count := UBound+1;
Memo1.Clear;
For i := 0 To UBound Do Begin
self.Caption := 'Va por: ' + IntToStr(i) + ' Total: ' + IntToStr(UBound);
oInfo := IDispatch(VarArrayGet(infos, i)) As IMailInfo ;
fileName := mailFolder + '\' + oTools.GenFileName(i) + '.eml';
oMail := oClient.GetMail( oInfo );
Memo1.Lines.Add(oMail.From.Address);
if (oMail.From.Address = oServer.User) then begin
oMail.SaveAs( fileName, true );
end;
End;
oClient.Quit;
Except
On ep:Exception Do
ShowMessage( 'Error: ' + ep.Message );
End;
End;
Buuumm!! oClient.Connect1(oServer.DefaultInterface); Unable to connect, I'm doing wrong? Never came to oClient.Imap4Folders;
Rank: Administration
Groups: Administrators
Joined: 11/11/2010(UTC) Posts: 1,153
Thanks: 9 times Was thanked: 55 time(s) in 55 post(s)
Hi, your codes are correct.
First of all, please make sure you defined const MailServerImap4 = 1;
Secondly, please check your connection to imap-mail.outlook.com like this:
under DOS command:
input:
telnet imap-mail.outlook.com 993
press enter.
If your connection to the server is ok, it should return a flash cursor, otherwise it returns "Could not open connection to ..."
If you don't have telnet client installed, please enable it like this:
http://social.technet.mi...client-in-windows-7.aspx By the way, could you generate a log file with LogFileName property and paste the content here ? please hide your password/user in the log file.
Rank: Administration
Groups: Administrators
Joined: 11/11/2010(UTC) Posts: 1,153
Thanks: 9 times Was thanked: 55 time(s) in 55 post(s)
By the way, i just tested hotmail IMAP4 by imap4_full sample in EAGetMail, it works fine.
See the following screenshot.
so I doubt if your anti-virus/anti-spam/router/firewall blocked your outgoing 993 port on your machine.
ivan attached the following image(s):
Rank: Newbie
Groups: Registered
Joined: 11/8/2013(UTC)
Posts: 2
Location: Buenos Aires
Thank you both. The problem was oServer.SSLType := ConnectSSL; The comment //oServer.SSLType := ConnectSSL;, and resolved my inconvenience.
Rank: Administration
Groups: Administrators
Joined: 11/11/2010(UTC) Posts: 1,153
Thanks: 9 times Was thanked: 55 time(s) in 55 post(s)
Originally Posted by: Marcos Thank you both. The problem was oServer.SSLType := ConnectSSL; The comment //oServer.SSLType := ConnectSSL;, and resolved my inconvenience.
But in your codes, you didn't set
oServer.SSLConnection = True;
I thought you should set that .
Forum Jump
EmailArchitect Support
Email Component Development
- EASendMail SMTP Component - .NET Version
- EASendMail SMTP Component - Windows Store Apps
- EASendMail SMTP ActiveX Object
- EAGetMail POP3 & IMAP4 Component - .NET Version
- EAGetMail POP3 & IMAP4 ActiveX Object
Exchange Server and IIS SMTP Plugin
- DomanKeys/DKIM for Exchange Server and IIS SMTP
- Disclaimer and S/MIME for Exchange Server and IIS
EmailArchitect Email Server
- EmailArchitect Email Server (General)
- EmailArchitect Email Server Development
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.