[SOLVED]Not able to send email with synpase lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Peterkl · 2016-03-30 18:19 Gretings everyone I've been trying to send an email using synapse. I followed this guide : http://wiki.freepascal.org/Synapse#Sending_email I do not get any errors while compiling or before compiling, the thing is I do not receive the email, and I've tried to used different emails already. I have the ssl library and the synapse package as well, i do not believe that is the problem : Here is the code : uses   classes, smtpsend,ssl_openssl; // MailData is the text of the mail. function SendMail(   User, Password,   MailFrom, MailTo,   SMTPHost, SMTPPort, MailData: string   ): Boolean; var   SMTP: TSMTPSend;   sl:TStringList; begin   Result:=False;   SMTP:=TSMTPSend.Create;   sl:=TStringList.Create;   try     sl.text:=Maildata;     SMTP.UserName:=User;     SMTP.Password:=Password;     SMTP.TargetHost:=SMTPHost;     SMTP.TargetPort:=SMTPPort;     SMTP.FullSSL:=true;     if SMTP.Login then     begin       writeln('connected');       readln;       result:=SMTP.MailFrom(MailFrom, Length(MailData)) and          SMTP.MailTo(MailTo) and          SMTP.MailData(sl);       SMTP.Logout;     end;   finally     SMTP.Free;     sl.Free;   end; end; var   Userk,Passwordk,MailFromk,MailTok,SMTPHostk,SMTPPortk,MailDatak : string; begin   Userk := '--------@gmail.com';   Passwordk:='--------';   MailFromk :='--------@gmail.com';   MailTok :='------------@gmail.com';   SMTPHostk :='smtp.gmail.com';   SMTPPortk :='465';   MailDatak :='This is a test'; SendMail(Userk, Passwordk,MailFromk, MailTok, SMTPHostk, SMTPPortk,MailDatak); end. I'm most likely doing something ridiculously wrong, but I just cannot see it for 2h:30min now. Thanks in advance. ---------------------------------------------------------------------- Trenatos · 2016-03-30 21:33 What is the value of result when you try to send? ---------------------------------------------------------------------- Josh · 2016-03-30 22:10 Hi QuoteSMTPHostk :='stmp.gmail.com'; maybe a typo; but should this be SMTPHostk :='smtp.gmail.com'; Josh ---------------------------------------------------------------------- Peterkl · 2016-03-30 22:16 Quote from: josh on March 31, 2016, 12:10:32 amHi QuoteSMTPHostk :='stmp.gmail.com'; maybe a typo; but should this be SMTPHostk :='smtp.gmail.com'; Josh Thank you m8, I changed it, but it did not solve a thing... But well seen anyway ---------------------------------------------------------------------- Peterkl · 2016-03-30 22:18 Quote from: Trenatos on March 30, 2016, 11:33:20 pmWhat is the value of result when you try to send? Well I do not know. I set the result to false in the function, but when I send it I simply got a message saying that everything was successful compiled and no other additional messages. ---------------------------------------------------------------------- balazsszekely · 2016-03-31 04:23 QuoteWell I do not know. I set the result to false in the function, but when I send it I simply got a message saying that everything was successful compiled and no other additional messages. I'm afraid lately you have to enable the "Access for less secure apps" in your gmail account, otherwise it won't work. Try this:     1. Login to your mail account     2. Go to the following page: https://www.google.com/settings/security/lesssecureapps     3. Click "Turn on"     4. Try to send a mail to your own account ---------------------------------------------------------------------- SymbolicFrank · 2016-03-31 07:37 I have tried to do that as well, a few months ago, but was unable to get it to work reliably. I could sometimes send a few mails before it was reset by Google. Next to the page linked by GetMem there is at least one other location where you can configure this, but I forgot where it was. ---------------------------------------------------------------------- Peterkl · 2016-03-31 17:32 Quote from: GetMem on March 31, 2016, 06:23:16 amQuoteWell I do not know. I set the result to false in the function, but when I send it I simply got a message saying that everything was successful compiled and no other additional messages. I'm afraid lately you have to enable the "Access for less secure apps" in your gmail account, otherwise it won't work. Try this:     1. Login to your mail account     2. Go to the following page: https://www.google.com/settings/security/lesssecureapps     3. Click "Turn on"     4. Try to send a mail to your own account It worked, thank you !