SendMail_Include.pbi (windows / linux / macos)

Share your advanced PureBasic knowledge/code with the community.
MC2015
New User
New User
Posts: 9
Joined: Fri Jun 14, 2013 9:42 pm

Re: SendMail_Include.pbi (windows / linux / macos)

Post by MC2015 »

@TS-Soft: You started this thread and you`re a great coder....do you use your code?
There are some changes made by some other users....
dige
Addict
Addict
Posts: 1247
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: SendMail_Include.pbi (windows / linux / macos)

Post by dige »

It seems there is something missing. Something like a datetimeformat declare.
For example using this date: 1. December 2013 -> 01/12/2013

Code: Select all

__SM_SendAndProt("Date:" + FormatDate("%dd/%mm/%yyyy @ %hh:%ii:%ss", Date()))
Result:
Outlook: 1. December 2013
Thunderbird: 12. Januar 2013
"Daddy, I'll run faster, then it is not so far..."
dige
Addict
Addict
Posts: 1247
Joined: Wed Apr 30, 2003 8:15 am
Location: Germany
Contact:

Re: SendMail_Include.pbi (windows / linux / macos)

Post by dige »

Code: Select all

Procedure.s __SendMail_GetFormatedDate(date.i)
  Protected Result.s
  
  ; DateTime Format RFC 5322
  ; Date: Mon, 4 Dec 2006 15:51:37 +0100

  
  Select DayOfWeek(date)
    Case 0 : Result = "Sun"
    Case 1 : Result = "Mon"
    Case 2 : Result = "Tue"
    Case 3 : Result = "Wed"
    Case 4 : Result = "Thu"
    Case 5 : Result = "Fri"
    Case 6 : Result = "Sat"
  EndSelect
  
  Result + ", " + FormatDate("%dd", date) + " "
  
  Select Month(date)
    Case 1 : Result + "Jan"
    Case 2 : Result + "Feb"
    Case 3 : Result + "Mar"
    Case 4 : Result + "Apr"
    Case 5 : Result + "May"
    Case 6 : Result + "Jun"
    Case 7 : Result + "Jul"
    Case 8 : Result + "Aug"
    Case 9 : Result + "Sep"
    Case 10: Result + "Oct"
    Case 11: Result + "Nov"
    Case 12: Result + "Dec"
  EndSelect
  
  Result + " " + FormatDate("%yyyy %hh:%ii:%ss", date) + " +0100"
  
  ProcedureReturn Result
EndProcedure
And change the date line like this:

Code: Select all

; __SM_SendAndProt("Date:" + FormatDate("%dd/%mm/%yyyy @ %hh:%ii:%ss", Date()))
  __SM_SendAndProt("Date:" + __SendMail_GetFormatedDate(Date()))
"Daddy, I'll run faster, then it is not so far..."
Liqu
User
User
Posts: 77
Joined: Sun Apr 21, 2013 10:31 am

Re: SendMail_Include.pbi (windows / linux / macos)

Post by Liqu »

this code is great,

i still hope it support gmail :)
do you have a free smtp server recommendation?

thank you very much
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: SendMail_Include.pbi (windows / linux / macos)

Post by IdeasVacuum »

To support gmail and similar requires TLS and SSL security - there are libs out there, but for commercial use a lot of money is involved.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: SendMail_Include.pbi (windows / linux / macos)

Post by ts-soft »

SMTP AUTH available in PB 5.10, so i think, this include is more or less obsolete :mrgreen:

No gmail support!
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Liqu
User
User
Posts: 77
Joined: Sun Apr 21, 2013 10:31 am

Re: SendMail_Include.pbi (windows / linux / macos)

Post by Liqu »

IdeasVacuum wrote:To support gmail and similar requires TLS and SSL security - there are libs out there, but for commercial use a lot of money is involved.
how about using RichAgeni's code for TLS and SSL
http://www.purebasic.fr/english/viewtop ... =5&t=52462

RichAgeni's code is great too but no attachments :(

for commercial use, we don't provide the dll, user must download the dll by himself/herself, so we don't need to pay the license right?

--

and when i tried to use this code to SMTP2GO.com, it failed with error :
[ ERR >Extension 'AUTH LOGIN' not supported - Quit< ]


@ts-soft
would you please try the PB SMTP AUTH to SMTP2GO.com's SMTP please?
i tried it but the pb hang? no timeout?

thank you very much
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: SendMail_Include.pbi (windows / linux / macos)

Post by IdeasVacuum »

for commercial use, we don't provide the dll, user must download the dll by himself/herself, so we don't need to pay the license right?
That might be a way round it, but how many customers will like that idea is another thing. Rich's code uses the cryptlib security toolkit library, which is not free for commercial use either. It also does not support Unicode (gmail is Unicode).

The best in terms of price, but also looking easy to use, is ActiveExperts SendEMail. 600 euros for a distribution license.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Liqu
User
User
Posts: 77
Joined: Sun Apr 21, 2013 10:31 am

Re: SendMail_Include.pbi (windows / linux / macos)

Post by Liqu »

IdeasVacuum wrote:
for commercial use, we don't provide the dll, user must download the dll by himself/herself, so we don't need to pay the license right?
That might be a way round it, but how many customers will like that idea is another thing. Rich's code uses the cryptlib security toolkit library, which is not free for commercial use either. It also does not support Unicode (gmail is Unicode).

The best in terms of price, but also looking easy to use, is ActiveExperts SendEMail. 600 euros for a distribution license.
thank you for your suggestion,
is there a PB Code for ActiveExperts SendEMail Lib?
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: SendMail_Include.pbi (windows / linux / macos)

Post by IdeasVacuum »

You can ask them that question. There are sample codes in many languages, so even if the answer is no, it should be easy to do. http://www.activexperts.com/activexperts/contact/
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Liqu
User
User
Posts: 77
Joined: Sun Apr 21, 2013 10:31 am

Re: SendMail_Include.pbi (windows / linux / macos)

Post by Liqu »

Fortunately, i just got a small cmd program to send email to GMAIL, it support SSL/TLS and it's free
I tested it in W7 x64 and it works but i doesn't work on Fresh Installed XP ( they said it need .NET Framework )
[ http://commandlinesendmail.blogspot.com/ ]

Download : http://www.atay.org/downloads/senditquiet.zip

they also post the source code at github :
https://github.com/atays/command-line-e ... nding-tool

Download : https://github.com/atays/command-line-e ... -pages.zip

Edited : It seems it use .NET's SSL ...

Thank you :)

----------------

Edited again :
i don't know why, but the pb mail system works with smtpcorp.com now hahaha, my bad
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: SendMail_Include.pbi (windows / linux / macos)

Post by IdeasVacuum »

Now that looks very interesting! Pity it's coded in C# but the exe can be run by PB.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Liqu
User
User
Posts: 77
Joined: Sun Apr 21, 2013 10:31 am

Re: SendMail_Include.pbi (windows / linux / macos)

Post by Liqu »

if only we can extract the .NET's System.Net.Mail
we can get free SSL / TLS haha

the downside using senditquiet is it needs .NET :(

Please let me know if you can convert it to PB or maybe make it usable on fresh installed XP ( portable .NET ? )

Thank you
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: SendMail_Include.pbi (windows / linux / macos)

Post by IdeasVacuum »

the downside using senditquiet is it needs .NET
That isn't a downside because all PC's, WinXP and up, have .NET, unless your app needs to work on Linux/OSX too.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
normeus
Enthusiast
Enthusiast
Posts: 414
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: SendMail_Include.pbi (windows / linux / macos)

Post by normeus »

I needed to send an HTML email, which cannot be done with PB mail library. Tried this library with NALOR changes and I get This error with multiple service providers. I am just showing hostgator as an example but it is not limited to them:

Code: Select all

[11:02:02] RCV >a.hostgator.com ESMTP Exim 4.82 #2 Wed, 13 May 2015 13:02:02 -0500 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.<
[11:02:02] SND >EHLO funkyLaptop-PC<
[11:02:02] RCV >b.hostgator.com Hello funkyLaptop-PC [192.168.0.39]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250-STARTTLS250 HELP<
[11:02:02] ERR >Extension 'AUTH LOGIN' not supported - Quit<

has anyone run into this kind of error? any fix?
I used the previous version and it worked so it has to do with EHLO command.
Thank you.
Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
Post Reply