External mail send [All OS]

Share your advanced PureBasic knowledge/code with the community.
User avatar
minimy
Enthusiast
Enthusiast
Posts: 349
Joined: Mon Jul 08, 2013 8:43 pm

External mail send [All OS]

Post by minimy »

Greetings!
Simple way to send mail using your own mail manager client.

Code: Select all

Procedure MailTo(address.s, subject.s, body.s)
;open your mail manager
  Protected ch.s="mailto:"+
                 address+
                 "?&subject="+ReplaceString(subject," ","%20")+
                 "&body="+ReplaceString(ReplaceString(body," ","%20"),Chr(13),"%0D%0A")
  RunProgram(ch)
EndProcedure
If translation=Error: reply="Sorry, Im Spanish": Endif
vwidmer
Enthusiast
Enthusiast
Posts: 282
Joined: Mon Jan 20, 2014 6:32 pm

Re: External mail send [All OS]

Post by vwidmer »

doesnt seem to work on my system..

Linux 4.9.35-1-MANJARO
WARNING: I dont know what I am doing! I just put stuff here and there and sometimes like magic it works. So please improve on my code and post your changes so I can learn more. TIA
Little_man
Enthusiast
Enthusiast
Posts: 143
Joined: Fri Mar 29, 2013 4:55 pm
Location: The Netherland

Re: External mail send [All OS]

Post by Little_man »

Changed code:

Code: Select all

Procedure MailTo(address.s, subject.s, body.s)
;open your mail manager
  Protected ch.s="mailto:"+
                 address+
                 "?subject="+ ReplaceString(subject," ","%20")+
                   ^
                    
                 "&body=" + ReplaceString(ReplaceString(body, " ","%20"), Chr(13), "%0D%0A")
  RunProgram(ch)
EndProcedure
Post Reply