hbtip and Email

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

User avatar
Rathinagiri
Posts: 5480
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: hbtip and Email

Post by Rathinagiri »

I had done a small sample here. It says mail sent successfully! Till now I'd not received the test mail. Let us see!

Code: Select all

#include <hmg.ch>

Function Main
local cServer := "smma.dataone.in"
private cFrom := "srgiri@dataone.in"
define window mail at 0,0 width 300 height 300 main
   define label tolabel
      row 10
      col 10
      width 50
      value "To"
   end label
   define textbox toaddress
      row 10
      col 60
      width 150
   end textbox
   define label subjectlabel
      row 40
      col 10
      width 50
      value "Subject"
   end label
   define textbox subject
      row 40
      col 60
      width 150
   end textbox
   define label bodylabel
      row 70
      col 10
      width 50
      value "Body"
   end label
   define editbox body
      row 70
      col 60
      width 150
      height 100
   end textbox
   define label smtplabel
      row 180
      col 10
      width 50
      value "SMTP Server"
   end label
   define textbox smtp
      row 180
      col 60
      width 150
      value cServer
   end textbox
   define button send
      row 220
      col 10
      caption "Send Mail"
      action sendmail()
   end button 
end window 
on key ESCAPE of mail action mail.release()

mail.center
mail.activate      

Return


function sendmail

&&hb_SendMail( cServer, nPort, cFrom, xTo, xCC, xBCC, cBody, cSubject, aFiles, cUser, cPass, cPopServer, nPriority, lRead, bTrace, lPopAuth, lNoAuth, nTimeOut, cReplyTo, lTLS, cSMTPPass, cCharset, cEncoding )
local cServer := mail.smtp.value
local xTo := mail.toaddress.value
local cSubject := mail.subject.value
local cBody := mail.body.value
local lOk := .f. 
lOk := hb_sendmail(cServer,,cFrom,xTo,,,cBody,cSubject,,,,,,,.f.)
if .not. lOk
   msgstop("Sending mail failed!")
else
   msginfo("Mail Sent successfully!")
endif
return nil      

East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
melliott42
Posts: 119
Joined: Wed Feb 18, 2009 2:14 pm

Re: hbtip and Email

Post by melliott42 »

rathinagiri,

Yes perfect!

What I also found was McAfee was getting in the way. Some of its settings stopped my ability to send email.

Thanks again.

Michael
Sankarasubramanian
Posts: 10
Joined: Sat Dec 18, 2010 2:04 pm

Re: hbtip and Email

Post by Sankarasubramanian »

Dear Mr.Rathinagiri,

Tried your sample program (with: to "san..@in.com", from "san..@gmail.com" & Server "smtp.gmail.com")

"Mail Sent successfully!" appears.

Not received the mail in the destination.

What is wrong with me? And further is it possible to attach a file (dbf) in this mail.

Please help.

Sankarasubramanian
User avatar
Rathinagiri
Posts: 5480
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: hbtip and Email

Post by Rathinagiri »

Yes, I think you can attach the files in the place of aFiles parameter.

Let me check again with another mail.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
mol
Posts: 3774
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: hbtip and Email

Post by mol »

Hi guys!
I needed simply program to send mails last.
I couldn't find anything easy to configuration, so I've decided to write my own.
It's not completed yest, but, I want to share this idea with you.
You can call it without parameters - so you can set everything, save these settings and send mail.
You can call it with parameters
/I name_of_ini_file
/A attachment_file

it's possible to call few times /A parameter - all listed files will be send, eg: /A file1 /A file2

remember to separate parameters with spaces!
this is configuration screen:
Image

and sources are placed HERE
Post Reply