SMTP with Outlook

Discussion forum about all things Team Developer 5.x and 6.x
jdurban
Germany
Posts: 6
Joined: 09 Oct 2018, 09:30
Location: Karlsruhe, Germany

SMTP with Outlook

Post by jdurban » 09 Oct 2018, 10:00

Hello,

I want to send an eMail with TD 6.3. Email has attached a small zip-file.
Can I use SMTP over Outlook? Or should I use other protocols?
In my Developer VM I use Firebird with SMTP, the demo app works (as far I'm looking for a more simple solution as QuickMail)
But I have to set user/pw. That's not good because if customer changes his windows pw, outlook works but the app doesn't work anymore.

Maybe I have to use MAPI because Outlook will accept any mail from the same Computer/Windows session as it's running.

Any idea?
thanks
Jürgen

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 761
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: SMTP with Outlook

Post by Igor Ivanovic » 09 Oct 2018, 12:15

AFAIK, the only way you can accomplish it is with MAPI.
I don't know of any other way.

I've been using MAPI for over 15 years now without any problems.
The pros are that the user can see the email before sending and to have it in his sent folder.
The cons are that the user have to dismiss two dialog boxes with a permission to send it.

For automated emails I am using SMTP with the default e-mail account in the BCC field.
Igor Ivanovic
Image

Didiman
Germany
Posts: 146
Joined: 21 Mar 2017, 13:05
Location: Bremen, Germany

Re: SMTP with Outlook

Post by Didiman » 09 Oct 2018, 13:45

We use SalMail.apl for some time now. Works perfectly, even with Attachments.

jdurban
Germany
Posts: 6
Joined: 09 Oct 2018, 09:30
Location: Karlsruhe, Germany

Re: SMTP with Outlook

Post by jdurban » 09 Oct 2018, 15:14

@ Didiman: in the help is written you need a CA file, really? Can I use the same user and pw as user is logged in without hard coding his password? Or should I use another eMail-account especially for sending the mail?
Can I use SalMail with SMTP to connect to an Exchange Server? Outlook is not really necessary on the Client, because the SalMailXX.dll will do the work.

thanks
Jürgen

Didiman
Germany
Posts: 146
Joined: 21 Mar 2017, 13:05
Location: Bremen, Germany

Re: SMTP with Outlook

Post by Didiman » 10 Oct 2018, 06:48

This is pretty simple, you can easily send an EMail like this:

Code: Select all

!!CB!! 70
SalMail: fcMail

Set bOk = TRUE
!
Call fcMail.SetMailServer( dfsSMTPServer, 0, FALSE, TRUE )
Call fcMail.Connect(  )
Set sGlobAttachments = sFilename || ';' || sGlobAttachments
Call fcMail.SendMail( MAIL_FORMAT_PLAIN_TEXT , dfsBetreff, cmbAbsender, cmbEmpfänger, cmbCC, 'Anbei die angeforderten Daten', sGlobAttachments, FALSE, 1 )
!
Call fcMail.Disconnect(  )
!
!
Return bOk 
You need nothing else.

Receiving works like this:

Code: Select all

!!CB!! 70
Set bFirst = TRUE
Call cMail.SetMailServer(sIMAPServer, 0, FALSE, FALSE)
Call cMail.SetUser( sMailUser,sMailPassword )
Call cMail.Connect(  )
Set _nCounter = 0
Set nMailFormat = 0
If cMail.GetNextMail( bFirst, nMailFormat,nMailID, sDateReceived,   sSubject, sOriginator, sRecipientsList ,sCarbon, mlsMailbody, sAttachments    ) = 0
	If sAttachments != ''
		Set nNumOfTokens = SalStrTokenize( sAttachments, '', ';', sFiles )
		While sFiles[_nCounter] != ''
			Set _nCounter=_nCounter+1 
	Call cMail.DeleteMail( nMailID )
!
Call cMail.Disconnect(  )
Return TRUE

greetz

--Andreas

EwaldP
Austria
Posts: 109
Joined: 07 Mar 2017, 08:00
Location: Austria

Re: SMTP with Outlook

Post by EwaldP » 10 Oct 2018, 07:27

We use different methods for sending mails.

a) our support receives error reports via mail sent by SalMail
b) user can send email via Outlook (MAPI)
c) user can send email via activex component (will not longer supported)

each method has pros and cons. For uncomplicated use I would prefer SalMail because it's small and quickly implemented. No worry about different outlook versions or outlook is not installed. If user interaction is necessary, I would prefer Outlook, otherwise you will need to implement an editor (HTML) as well most users are used to working with Outlook.
Ewald P. Palmetshofer
EDV-Hausleitner GmbH
4020 Linz
www.edv-hausleitner.at

Igor Ivanovic
Site Admin
Site Admin
Croatia
Posts: 761
Joined: 05 Mar 2017, 12:37
Location: Zagreb, Croatia

Re: SMTP with Outlook

Post by Igor Ivanovic » 10 Oct 2018, 08:15

jdurban wrote:
09 Oct 2018, 15:14
@ Didiman: in the help is written you need a CA file, really? Can I use the same user and pw as user is logged in without hard coding his password? Or should I use another eMail-account especially for sending the mail?
Can I use SalMail with SMTP to connect to an Exchange Server? Outlook is not really necessary on the Client, because the SalMailXX.dll will do the work.

thanks
Jürgen
You only need the CA file if you are connecting to the email server using SSL, for a regular connection you don't need it.
SalMail will work with any SMTP server, so you need to use the account from the mail server.
It can be the account of the user logged in, but then you will need to know the user/pssw combination for every user which I personally don't like.
You can set the Originator to the user email address, as the originator doesn't have to be the same as the account you are using to send mails.
Igor Ivanovic
Image

clemdoc
Austria
Posts: 10
Joined: 08 Mar 2017, 09:51
Location: Austria

Re: SMTP with Outlook

Post by clemdoc » 10 Oct 2018, 08:21

My 2 cents:
Our clients want to see the mails they sent in their sent-mails folder [1].
So we're using Outlook (or Lotus Notes) via COM automation.
For Outlook, I can recommend the excellent Redemption Library [2] (see http://www.dimastr.com/redemption/), which has a very powerful and stable interface to Outlook/MAPI and can also be loaded without being registered (I posted a solution for that somewhere).

HTH & HAND, clem

[1] Bcc'ing them confused them, as the mails got into their Inbox and... well... let's not go there.
[2] I'm not working for them nor am I affiliated with them in any way.

jdurban
Germany
Posts: 6
Joined: 09 Oct 2018, 09:30
Location: Karlsruhe, Germany

Re: SMTP with Outlook

Post by jdurban » 15 Oct 2018, 14:27

thanks for all answers!
I was just a littlebit confused by the Gupta samples app, because it works not without an eMail Client, but after installing firebird it works.
Meanwhile I use SALMail and it works (easily..) with my t-Online (test-) account well and described by Andreas. Without Outlook and anything else...
Only with my own Exchange Server it doesn't work (grrr..), but the reason will be the settings of my ExchangeServer itself.

jdurban
Germany
Posts: 6
Joined: 09 Oct 2018, 09:30
Location: Karlsruhe, Germany

Re: SMTP with Outlook

Post by jdurban » 17 Oct 2018, 14:25

Hi,

hmm, sending mails with ExchangeServer doesn't work - with t-Online easily (using SALMail).
What's the difference with ExchangeServer and other servers?
I tested servername and IP-address, port is correct, SSL = TRUE, user is set, with or without password.
SendMail return always -1 and no mail was send (I only will send).

Any ideas? What else should I test? Both ExchangeServer runs well and all users in the AD send and receive Mails (with Outlook).

thanks,
Jürgen

EwaldP
Austria
Posts: 109
Joined: 07 Mar 2017, 08:00
Location: Austria

Re: SMTP with Outlook

Post by EwaldP » 18 Oct 2018, 08:44

T-Online has always SSL = TRUE? Do you have installed a CA-file for SSL support?
Ewald P. Palmetshofer
EDV-Hausleitner GmbH
4020 Linz
www.edv-hausleitner.at

jdurban
Germany
Posts: 6
Joined: 09 Oct 2018, 09:30
Location: Karlsruhe, Germany

Re: SMTP with Outlook

Post by jdurban » 18 Oct 2018, 09:02

yes, t-Online uses SSL=TRUE, it doesn't work with SSL=FALSE. T-Online uses "STARTTLS, Auth method: Passwort/normal (=Settings of Firebird for t-Online).
There are other methods: no auth, password/normal, encrypted Password, Kerberos / GSSAPI, NTLM, OAuth2.
So, if Exchange forces one of the other Settings I can't connect...?

I don't have installed a CA-file for SSL Support. Maybe Exchange need one but t-Online not?

thanks

jdurban
Germany
Posts: 6
Joined: 09 Oct 2018, 09:30
Location: Karlsruhe, Germany

Re: SMTP with Outlook

Post by jdurban » 18 Oct 2018, 09:06

sorry settings where copied from Thunderbird as eMail-client, not Firebird. Thunderbird was installed as test-email client for my T-Online account.

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests