Page 2 of 2

Re: hbtip and Email

Posted: Mon Jul 26, 2010 2:06 pm
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      


Re: hbtip and Email

Posted: Mon Jul 26, 2010 2:25 pm
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

Re: hbtip and Email

Posted: Fri Mar 11, 2011 2:23 pm
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

Re: hbtip and Email

Posted: Fri Mar 11, 2011 2:44 pm
by Rathinagiri
Yes, I think you can attach the files in the place of aFiles parameter.

Let me check again with another mail.

Re: hbtip and Email

Posted: Tue Nov 01, 2011 7:51 am
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