32 bit SSL SMTP

Windows specific forum
SeregaZ
Enthusiast
Enthusiast
Posts: 619
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: 32 bit SSL SMTP

Post by SeregaZ »

it have attach creation function for letters?
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: 32 bit SSL SMTP

Post by RichAlgeni »

I believe you are asking about attachments? No, it does not handle attachments.

That being said, I would use the latest version of the built in library from PureBasic! It handles attachments and does TLS security! The process that I wrote should be considered deprecated.
SeregaZ
Enthusiast
Enthusiast
Posts: 619
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: 32 bit SSL SMTP

Post by SeregaZ »

this one have attachments :) http://forum.purebasic.com/english/view ... a952c0b79a

but it need comate.


and i am not like this:
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/config ... ndusername') ="+ "'"+ Username+"'")
objemail\SetProperty("Configuration\Fields\Item ('http://schemas.microsoft.com/cdo/config ... ndpassword') =" +"'"+ Password +"'" )

Billy G get my password for email?!?!?!?
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: 32 bit SSL SMTP

Post by RichAlgeni »

Make sure you are using PureBasic version 5.4x or better! 5.42 is the latest production release.

Then go here to see the built-in PureBasic library for sending mail:

http://www.purebasic.com/documentation/mail/index.html

And here:

http://www.purebasic.com/documentation/ ... dmail.html

Use the optional flag: #PB_Mail_UseSSL.

Set the port to 587, the PureBasic team has included the STARTTLS to run automatically. This should give everything you need!

Rich
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: 32 bit SSL SMTP

Post by RichAlgeni »

This code should show you how to do everything you need:

Code: Select all

; process to test new email capabilities in PB 5.40

EnableExplicit

;****************************************************************************************
; send out the page to the secure server
;****************************************************************************************

Procedure SendPage()

    Protected result.i
    Protected logText.s
    Protected mailNumber.i
    Protected emailType.s    = "text/plain"
    Protected mailHost.s     = "smtp.gmail.com"
    Protected userName.s     = "user.name@gmail.com"
    Protected mailFrom.s     = "user.name@gmail.com"
    Protected mailPort.i     = 587
    Protected mailTo.s       = "someone_else@some_email.com"
    Protected subject.s      = "64 bit email Test using TLS Encryption"
    Protected emailBody.s    = "Dear Sir, this email is brought to you courtesy of 64 bit TLS Encryption."

    PrintN("Enter the password for " + userName)
    Protected password.s     = Input()

    PrintN("SendPage() > About to create mail!")

    mailNumber = CreateMail(#PB_Any, userName, subject)
    If mailNumber > 0
        AddMailRecipient(mailNumber, mailTo, #PB_Mail_To)
        SetMailBody(mailNumber, emailBody)
        result = AddMailAttachmentData(mailNumber, "attachment", @emailBody, Len(emailBody), emailBody)
        PrintN("SendPage() > AddMailAttachmentData return value: " + Str(result))
        result = SendMail(mailNumber, mailHost, mailPort, #PB_Mail_UseSSL, userName, password)
        PrintN("SendPage() > SendMail return value: " + Str(result))
        FreeMail(mailNumber)
    Else
        PrintN("SendPage() > error creating mail process")
    EndIf

EndProcedure

; open the console window, initialize the network, send the message, then quit

InitNetwork()

OpenConsole()

SendPage()

Input()

CloseConsole()
SeregaZ
Enthusiast
Enthusiast
Posts: 619
Joined: Fri Feb 20, 2009 9:24 am
Location: Almaty (Kazakhstan. not Borat, but Triple G)
Contact:

Re: 32 bit SSL SMTP

Post by SeregaZ »

and how to read letters? server request SSL.
Post Reply