Post by votan on Oct 29, 2008 15:05:38 GMT -5
I was looking for a way to actually send attachments along with emails through RB. But as the SMTP handler is still very limited, I was searching for an easy lightwight SMTP mailer to replace the RB internal handler (after using uuencode first). I tried some trial versions of "buy them after 30 days" programs.... but they basically all had the same functionality like blat, a free tool. (except that the pay programs also provide pop3 access.. but that's for later).
Anyway, even so blat did send emails and attachments, it always returned stupid errormessages (Vista!?)... other similar free blown up programs didn't work at all. So, finally.. after a full day of crawling through the net, I found a small command line tool, that works just out of the box! ... and additionally is available for win32 and linux! ..... SendEmail.... available here caspian.dotconf.net/menu/Software/SendEmail/.
The script below just demonstrates the basics of sending emails with attachments through SendEmail... no errorchecking, filename- or email validation etc. So if you use this for testing, only attach files with no strange characters in their names etc...
The biggest limitation is the unflexible upload-function of RB... that's why it reads "upload" instead of "send" all the time!
And it prevents me from realizing multi-attachments.... hope the upload function will get upgraded soon!?
Just save the SendEmail executable to some place inside the RBP tree and change the settings in the program accordingly.
For security reasons set your smtp server to only accept SMTP requests from the machine where SendMail is running on... you don't want your mailserver to become a relay for others.... in case someone will ever find out your mail-user-password.
Anyway, even so blat did send emails and attachments, it always returned stupid errormessages (Vista!?)... other similar free blown up programs didn't work at all. So, finally.. after a full day of crawling through the net, I found a small command line tool, that works just out of the box! ... and additionally is available for win32 and linux! ..... SendEmail.... available here caspian.dotconf.net/menu/Software/SendEmail/.
The script below just demonstrates the basics of sending emails with attachments through SendEmail... no errorchecking, filename- or email validation etc. So if you use this for testing, only attach files with no strange characters in their names etc...
The biggest limitation is the unflexible upload-function of RB... that's why it reads "upload" instead of "send" all the time!
And it prevents me from realizing multi-attachments.... hope the upload function will get upgraded soon!?
Just save the SendEmail executable to some place inside the RBP tree and change the settings in the program accordingly.
'--- This supersimple email/attachment contact-form requires the external SMTP sendEmail
'--- Get it here: http://caspian.dotconf.net/menu/Software/SendEmail/ (linux/win32)
'--- or modify the program to use another SMTP mailer
'-------------------------------------------------------------------------------------
'--- program settings:
email$ = "myaddress@myserver.com" '--- receiver address
server$ = "mail.myserver.com" '--- SMTP server
mailuser$ = "username" '--- SMTP user (often this is also a full email like "username@myserver.com"
mailpwd$ = "userpassword" '--- SMTP auth password
sendmaildir$ = "\tools\mail\sendEmail.exe" '--- path to SendEmail (relative to DefaultDir$)
[start]
from$ = ""
subject$ = ""
message$ = ""
[email]
cls
html "<table>"
html "<tr><td>Your email:</td><td>"
textbox #from, from$
html "</td></tr>"
html "<tr><td>Subject:</td><td>"
textbox #subject, subject$
html "</td></tr>"
html "<tr><td>Message:</td><td>"
textarea #message, message$
html "</td></tr>"
html "</table>"
print
if attachfile = 1 then
button #attach, "Delete attachment", [attachonoff]
else
button #attach, "Add attachment", [attachonoff]
print
button #send, "Upload", [sendIt]
wait
end if
if attachfile = 1 then upload "Select a file to upload."; file$
[sendIt]
from$ = #from contents$()
subject$ = #subject contents$()
message$ = #message contents$()
cmd$ = DefaultDir$;sendmaildir$;" -f ";from$;" -t ";email$;" -s ";server$;" -xu ";mailuser$;" -xp ";mailpwd$;" -u ";subject$;" -m ";message$;" -a ";file$
cmdresult$ = shell$(cmd$)
cls
print "Your message has been send."
print
button #again, "Send another mail", [start]
wait
[attachonoff]
from$ = #from contents$()
subject$ = #subject contents$()
message$ = #message contents$()
if attachfile <> 1 then
attachfile = 1
goto [email]
end if
if attachfile = 1 then
attachfile = 0
goto [email]
end if
For security reasons set your smtp server to only accept SMTP requests from the machine where SendMail is running on... you don't want your mailserver to become a relay for others.... in case someone will ever find out your mail-user-password.