Hi, thanks, i have been reading a lot about pascal, i managed to create lots of stuff...
I can't however, send emails, i think gmail is closing my connections instantly, and i have already turned on the "less secure apps" option on my gmail.
i am using this script dimitry send:
procedure Form1_bReport_OnAfterClick (Sender: string);
var
sFile: string;
begin
Form1.bReport.Enabled := False;
Form1.bReport.Caption := 'Please wait...';
sFile := Form1.frxPDFExport1.FileName;
if FileExists(sFile) then
if SendMail('smtp.gmail.com, 'username@gmail.com', 'password', 465 , 'my name', 'destination email', 'Subject', 'Message', sFile) then
ShowMessage('Message sent');
Form1.bReport.Enabled := false;
Form1.bReport.Caption := 'Send PDF to e-mail ';
end;
begin
Form1.frxPDFExport1.OpenAfterExport := false;
end.
it gives me "connection ended gracefully (lol)
My intention is to have this code working, and then adding something like:
sEmail := Form1.edit1.text; on the "destination email" so it could send an email automatic to the email that is on this specific field
could you guys give me an hand? thanks
EDIT: it seems that it doesn't work with either Yahoo, Gmail or Outlook, but... i created an email @ portugalmail, it uses port 465 too but it doesn't use ssl that's the only difference, i was able to configure the script correctly...
Could this be that the command for sending the email (sendmail) doesn't have a field for ssl connections?
EDIT2: Need an extra help with something:
I am able to get a string from a textbox to send my email, here's the code i used:
procedure main_btemailfo_OnAfterClick (Sender: string);
var
sFile: string;
sEmail: string;
begin
main.btemailfo.Enabled := False;
main.btemailfo.Caption := 'Please wait...';
sFile := main.frxPDFExport1.FileName;
sEmail := frmassistencia.BxClienteEmail.sqlValue;
if FileExists(sFile) then
if SendMail('smtp.portugalmail.pt', 'xxxxxxxxxxxx@portugalmail.pt', 'xxxxxxxxxx', 465 , 'xxxxxxxxxxr@portugalmail.pt', 'xxxxxxxxxxxx@gmail.com' , 'subject', semail, sFile) then
ShowMessage('Message sent');
main.btemailfo.Enabled := true;
main.btemailfo.Caption := 'Email ';
end;
Now... picture this:
I have two tables: one named table1, and another one named table2
I have linked the table1 table with the table2 table, and i have a table1_id value
I have the email value on the table1 , and i have a combo box on (lets imagine) form1
this combobox is the table2.table1_id , and i have choosen to pick them using their phone (names would be too long, emails some people don't have, etc... etc...)
in form1 i have a text box pointing to table1 "email" value , it doesn't get updated automatic when i choose the combo box related to the customer i want, but when i reopen form1 after i save it, it will show up there...
My question is: is there a way to automatic update the form1 ? i mean... i guess i have to save it contantly and retrive it (save & show) probably....
Otherwise:
Is there another way to pick the "email" data that's on the right customer associated to the right combobox value ?
I hope you understand my question
Many thanks
p.s. i know the "semail value" on my code is on the "message field" but i was trying to debug and see what's going on each time i switched it arround, so i would get an email showing that value i was getting each time i changed my selection, i know i could use a simple "show message" text but i only remembered it later...