Forum > Beginners

Please i need help with xmailer demo

(1/2) > >>

evat:
I have Lazarus installed on windows 7. Tried to send mail using xmailer demo.
Got message "file not open. Press ok to ignore and risk data corruption.
The package xmailerpkg.lpk has compiled ok but it did not give me the option to install it. I added it to the project.

Thanks in advance for any help.


 
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.Button1Click(Sender: TObject);var Mail:TSendMail;begin  Mail := TSendMail.Create;    try      try        // Mail        Mail.Sender := 'eu@yahoo.com.br';        Mail.Receivers.Add('somebody@uol.com.br');        Mail.Subject := 'Este é o assunto';        Mail.Message.Add('Esta é a mensagem.');        // SMTP        Mail.Smtp.UserName := 'eu@yahoo.com.br';        Mail.Smtp.Password := '#########';        Mail.Smtp.Host := 'smtp.mail.yahoo.com';        Mail.Attachments.LoadFromFile('myfile.txt');        Mail.Smtp.Port := '465';        Mail.Smtp.SSL := True;        Mail.Smtp.TLS := True;        Mail.Send;        Write('E-mail sent successfully!');      except        on E: Exception do          Write(E.Message);      end;    finally      Mail.Free ;end;end;end.            

engkin:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---        Mail.Attachments.LoadFromFile('myfile.txt');
Try to put the full path to myfile.txt
or put a copy of it in Lazarus folder

evat:
Thanks for the reply, but this error message occurs even without file attachment. 
The code is working partially: the message (and the file attached) are sent, althought the error message is showed.
Since xmailer uses the synapse libraries, i  tried xmailer with the estable synapse and also with svn synapse.
I have another project in another folder which works fine using xmailer.
I do not see any diference between the two projects. Even the DLL libraries are the same version.

Thanks in advance for any help

engkin:
Are you attaching one file named myfile.txt, if so then use: 
--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---Mail.Attachments.Add('myfile.txt');
Attachments is a list of files to be attached. It is of type TStrings (TStringList in the constructor)

evat:
Thanks for the reply. Many thanks for your attention.
I have changed  Mail.Attachments.LoadFromFile('myfile.txt'); to Mail.Attachments.Add('myfile.txt');
The  code sends the message with the attached file but the only message it shows is that in Atach3.
I think the problem is that  i do not know how to configure Lazarus in Tools ===>Options and i do not know how to configure the Project Options.
 In Attach1 i show how Lazarus is configured. In Attach2 i show how the project is configured. I hope you can help me in this part.
Thank you.

Navigation

[0] Message Index

[#] Next page

Go to full version