Cant Send EMAIL!

Just starting out? Need help? Post your questions and find answers here.
arma
User
User
Posts: 61
Joined: Sun Jul 24, 2016 11:54 pm

Cant Send EMAIL!

Post by arma »

Hello everybody,

I can not send email, i use purebasic own sample code inside the help. But it gives error!
Do i need to setup any mail client? Such as thunderbird or outlook etc.
My system is clean. There is no mail client software.
Is this the what i need? Or i have any thing else to solve this situation.

*P.S. I use Purebasic v5.60 + Ubuntu
wombats
Enthusiast
Enthusiast
Posts: 664
Joined: Thu Dec 29, 2011 5:03 pm

Re: Cant Send EMAIL!

Post by wombats »

I could not get it to work with the smtp.free.fr mail server in the example, but it did work when I used a different one (Mailjet). I tested it on Windows 10 and Ubuntu. I do not have any mail clients setup.
arma
User
User
Posts: 61
Joined: Sun Jul 24, 2016 11:54 pm

Re: Cant Send EMAIL!

Post by arma »

I use my gmail account... And Orginal sample inside help... Ofcourse i change the variables for may gmail account... But it gives "0"...

Code: Select all

  InitNetwork()

  ; Be sure to use the right login and right password
  ;
  Login$ = "yourlogin"
  If CreateMail(0, Login$ + "@gmail.com", "Hello")
    AddMailRecipient(0, "youraddress@youraddress.com", #PB_Mail_To)

    Debug SendMail(0, "smtp.gmail.com", 587, #PB_Mail_UseSSL, Login$, "password")
  EndIf
__________________________________________________
Code tags added
22.05.2017
RSBasic
User avatar
Bisonte
Addict
Addict
Posts: 1233
Joined: Tue Oct 09, 2007 2:15 am

Re: Cant Send EMAIL!

Post by Bisonte »

PureBasic 6.10 LTS (Windows x86/x64) | Windows10 Pro x64 | Asus TUF X570 Gaming Plus | R9 5900X | 64GB RAM | GeForce RTX 3080 TI iChill X4 | HAF XF Evo | build by vannicom​​
English is not my native language... (I often use DeepL to translate my texts.)
wombats
Enthusiast
Enthusiast
Posts: 664
Joined: Thu Dec 29, 2011 5:03 pm

Re: Cant Send EMAIL!

Post by wombats »

arma wrote:I use my gmail account... And Orginal sample inside help... Ofcourse i change the variables for may gmail account... But it gives "0"...

Code: Select all

  InitNetwork()

  ; Be sure to use the right login and right password
  ;
  Login$ = "yourlogin"
  If CreateMail(0, Login$ + "@gmail.com", "Hello")
    AddMailRecipient(0, "youraddress@youraddress.com", #PB_Mail_To)

    Debug SendMail(0, "smtp.gmail.com", 587, #PB_Mail_UseSSL, Login$, "password")
  EndIf
__________________________________________________
Code tags added
22.05.2017
RSBasic
I tried your code with my Gmail account. At first, I had the same results as you, but when I added the #PB_Mail_Asynchronous flag to the SendMail command, it worked.
Post Reply