Bad Email Dreams ...

Re: Bad Email Dreams ...

Postby Gale FORd » Mon May 14, 2012 11:33 pm

Are you sure you used a valid file name?
If you are using xHarbour try this sample
Code: Select all  Expand view  RUN

#define olMailItem 0  // Mail object
#define olByValue  1   // attachment is a copy of the original file and can be accessed even if the original file is removed
function main
   local oOutlook, oMail
   local cFilePath, cFileName

   oOutlook = CREATEOBJECT( "Outlook.Application" )
   oMail = oOutlook:CreateItem( olMailItem )
   oMail:Recipients:Add( 'gale.ford@wwrowland.com.com' )

   cFilePath := "c:\xharbour\"
   cFileName := "
xdiff.txt"
   if file( cFilePath+cFileName )
      // oMail:Attachments:Add(  cFilePath+cFileName, olByValue, 1, cFileName )
      oMail:Attachments:Add( cFilePath+cFileName )
   else
      ? 'File not found'
   endif
   oMail:Subject = 'Hello'

   oMail:Body = "
This is a test." // Text only body
   oMail:Display = .T.
   // oMail:HTMLBody = MEMOREAD( "
c:\xharbour\test.htm" )
   //oMail:Send()
return nil


If you want to automatically send, I really do not like using this method. The new Outlook security is a pain. As long as you do not oMail:send() it can work ok.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Bad Email Dreams ...

Postby TimStone » Mon May 14, 2012 11:53 pm

Windows explorer is a nuisance when it doesn't show the extension.

I was attaching the error file which is text. Using error.txt fails, using error.log worked.

Thanks.

These are single emails with attachments. I'm going to create several options for them to use, including SMTP, Outlook, standard MAPI ( in case they have another email client ). Of course those who do strictly web based email clients don't understand why we can't email through them ( though their web client doesn't support the services ).

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Bad Email Dreams ...

Postby Otto » Tue May 15, 2012 8:12 am

Tim,
For my AktiveReport a reporting tool inside WINHOTEL which sends email reports to selected subscribers I made a workaround. I am sending the reports with FTP to my server and from there I send the emails.
It is too difficult to send automatically from clients PCs emails (Antivirus and other setup cases).
You could do the same with your error.log. You could send them through FTP to your server.

This is my configuration screen. You select the type of report and the recipients and when the report should be send.


Image


Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: Bad Email Dreams ...

Postby Randal » Tue May 15, 2012 1:08 pm

TimStone wrote:These are single emails with attachments. I'm going to create several options for them to use, including SMTP, Outlook, standard MAPI ( in case they have another email client ). Of course those who do strictly web based email clients don't understand why we can't email through them ( though their web client doesn't support the services ).

Tim


Tim:

I used to require a mapi program but this resulted in a lot of tech support and hassle, especially when Microsoft quit including Qutlook Express with Windows. Additionally, many users had problems using Outlook for security reasons. You can download and use Windows Live Mail with Vista and Win 7 but a lot of users were reluctant to download, install, and configure it for their email client and/or wanted us to do it for them. I no longer wanted to be dependent on someone else's email program. The other issue is the one you mentioned where a lot of users want to use web based email. If a user is using webbased email you can still send email using the smtp server of their internet provider.

For these reasons I went with smtp and so far it seems to be working fine. In addition to sending individual emails users can send batch emails (statments, invoices, notices, etc.) to numerous recipients at one time. I could never get the tsmtp class to work in all situations so I went with a 3rd party library. www.catalyst.com. Works with gmail, hotmail, and many other webbased email programs as well. We are only sending emails and not managing incoming email. We sometimes have minor tech support issues helping users specify the correct parameters for their smtp server. Users can check their email the same way they always have. The user can specify whatever From email they want so their recipients will reply to whatever email address they want them to regardless of the smtp server used to send email. Except with gmail, which requires the From be a gmail email address.

It's been my experience that you need to be able to configure certain parameters for certain smtp servers, i.e. some require authentication, some don't, some require SSL, some don't, etc.

Randal
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Re: Bad Email Dreams ...

Postby TimStone » Tue May 15, 2012 3:52 pm

Randal,

Thanks for the post. What Catalyst product are you using ? What compiler ? How did you elect to implement it ?

I do provide for various options ( authentication, alternate port, etc ), but most of my clients have no idea how to access their SMTP servers. In some cases, when it works, it does so for awhile, and then it doesn't.

Otto,

My clients usually don't automate emails ( although they can send service reminders automatically ). In most cases, they have a document ( which I convert to PDF and attach it to an email ) which they send to a client. When they send an email for tech support, it automatically picks up the error.log file from their computer which helps me a lot.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Bad Email Dreams ...

Postby Otto » Tue May 15, 2012 4:06 pm

Tim,

>When they send an email for tech support, it automatically picks up the error.log file from their computer which helps me a lot.
I thought you can send this error.log with FTP to your server.
This way you can forget about sending email.


Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: Bad Email Dreams ...

Postby TimStone » Tue May 15, 2012 4:18 pm

Otto,

Actually, I am trying to focus on them using email for tech support. When one of my clients calls me, they are often frustrated, and can't find the words to express themselves. Emails are more efficient. I respond to them in minutes. The error log makes it easy as an attachment.

Also, they don't have "servers" available to their clients, but they often have to send invoices as a PDF attachment to an email. These same people can't do searches to find attachments. No matter what training I provide, they still don't do it, get frustrated, and blame the software.

So, in my world ( client base ), I have to make it very simple.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Bad Email Dreams ...

Postby Randal » Tue May 15, 2012 7:04 pm

TimStone wrote:Randal,

Thanks for the post. What Catalyst product are you using ? What compiler ? How did you elect to implement it ?

I do provide for various options ( authentication, alternate port, etc ), but most of my clients have no idea how to access their SMTP servers. In some cases, when it works, it does so for awhile, and then it doesn't.



Tim:

I'm using the Socket Tools Library Edition with dll's and xHarbour. I defined all the functions I'm using with DLL FUNCTION. I think I posted these on this forum a while back.

I have one screen where the input their smtp server name, account name, password, port, with checkboxes for SSL and authenticate.

You'll see the library has all kinds of functions for internet, smtp, ftp, etc. I believe they have a 30 day demo.

If it works for while and then doesn't because there is a problem with their smtp server then it's not going to work with their email client (Outlook, Live Mail, etc) either.

Randal
Randal
 
Posts: 260
Joined: Mon Oct 24, 2005 8:04 pm

Re: Bad Email Dreams ...

Postby AlexSchaft » Wed May 16, 2012 5:31 am

TimStone wrote:For several years I have used SMTP so my clients can send emails. It works fine for me, and for many others, but on too many, it won't work. My guess is their service provider blocks the response, so the program never actually sends the email.

Tim,

Do you have any kinds of logs from the smtp session with the clients that fail? One thing we have noticed is that if a mail comes from a dynamic ip address (ISP assigned), then a lot of servers will reject it because chances are good it might be spam. In that case people usually need to send via their ISP mail server and authenticate.

Alex
User avatar
AlexSchaft
 
Posts: 172
Joined: Fri Oct 07, 2005 1:29 pm
Location: Edenvale, Gauteng, South Africa

Re: Bad Email Dreams ...

Postby TimStone » Wed May 16, 2012 3:01 pm

Alex,

Thanks for the comment. Mine is really a customer based issue rather than a FW problem. My clients really don't know ( understand ) their email service provider. Also, some of the ISP's contract off to other services, ie. Yahoo. Finally, many use webmail, and have no idea how to find the SMTP settings.

There are two areas of interest. First, for some, Outlook was working fine ( SMTP ), but the same settings with my program were not working. In other cases, when the settings in my program matched those in Outlook, it worked well. Secondly, my ISP provides a dynamic IP, but I have no problems. Also, I have tried hosting email accounts on my primary website. It works for me ( as does my ISP email ). However, for the clients who are having problems, it doesn't work for them.

The SMTP log usually indicates no connection / reply from the server ( when it fails ).

I did set it up with the CDO code provided earlier, and it is working from here ( but then I've never had a problem ). I'll see if that will work for my clients who are having problems.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Bad Email Dreams ...

Postby Otto » Fri May 18, 2012 3:30 pm

Tim, only to mention it. You can install a Help Desk on your homepage, too.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: Bad Email Dreams ...

Postby TimStone » Fri May 18, 2012 3:35 pm

Otto,

I actually did that, but this client base didn't use it. I also had a forum, but only the pornographers posted there.

I have a whole new set of websites going up in July and will have a new help desk and forum.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Bad Email Dreams ...

Postby TimStone » Thu May 24, 2012 5:53 pm

Using the CDOSYS method ( actually sent to me previously by Richard ), I had the following result:

Using xHarbour ( .com ) it builds and works correctly.

Using FWH 12.04, Harbour, and MSVC 2010, I get the following message displayed when I press the Send button:

Envoi Message Impossible
Errour 1
SubC 1006
OS Code 2147352573
Subsystem WINOLE
Message Argument error

Error messages are helpful WHEN we have a resource to understand them. Can anyone point me to a reference where I can decode this message and fix the problem ?

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Bad Email Dreams ...

Postby nnicanor » Fri May 25, 2012 1:28 am

Tim,

Can you post code, to help you how can solve your error.

Regards,
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
nnicanor
 
Posts: 302
Joined: Fri Apr 23, 2010 4:30 am
Location: Colombia

Re: Bad Email Dreams ...

Postby TimStone » Thu May 31, 2012 12:41 am

Nincanor,

Thank you for the comment. I'm sorry for the long delay, but I had to replace my computer and it takes several days to get everything loaded and configured. He is the code that was used, resulting in the error. It works fine in xHarbour ( .com version ) but gives the error I mentioned earlier in Harbour ( with MSVC 2010 ).

Tim

Code: Select all  Expand view  RUN

FUNCTION SMTPMAILS(TABMAIL)
Local oCfg, oMsg, oError,cToken, ;
      nEle     := 1, ;
      dBcc     := SPACE(1000)

/* Tabmail

01 = MAILSERVER
02 = MAILFROM
03 = MAILTO
04 = SUBJECT
05 = BODY
06 = ATTACHMENT
07 = BCC
08 = LAUTHORIZATION
09 = USERID pour MAILSERVER
10 = PW     pour MAILSERVER
11 = Mail port   defaut = 25
12 = Mail HTML page
13 = ssl authentification
14 = Mail sender
15 = Organisation sender

*/


IF TABMAIL[11] = 0 // PORT
   TABMAIL[11] := 25
ENDIF

Try
   oCfg := CreateObject( "CDO.Configuration" )

   With Object oCfg:Fields
      :Item( "http://schemas.microsoft.com/cdo/configuration/smtpserver" ):Value := Trim(TABMAIL[01])
      :Item( "http://schemas.microsoft.com/cdo/configuration/smtpserverport" ):Value := TABMAIL[11] // nPort
      :Item( "http://schemas.microsoft.com/cdo/configuration/sendusing" ):Value :=  2
      :Item( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate" ):Value := TABMAIL[13] // lauth

      IF LEN(ALLTRIM(TABMAIL[09])) > 0
         :Item( "http://schemas.microsoft.com/cdo/configuration/sendusername" ):Value := Trim( TABMAIL[09] )
         :Item("http://schemas.microsoft.com/cdo/configuration/sendpassword" ):Value := Trim( TABMAIL[10] )
      ENDIF
      :Item( "http://schemas.microsoft.com/cdo/configuration/smtpusessl" ):Value := TABMAIL[13] // cssl
      :Update()
   End With

   SYSREFRESH()
   oMsg := CreateObject( "CDO.Message" )

   With Object oMsg
      :Configuration := oCfg
      :From          := Trim( TABMAIL[02] )
      :To            := Trim( TABMAIL[03] )
      :ReplyTo       := TABMAIL[14]
      :Subject       := Trim( TABMAIL[04] )
      :Sender        := TABMAIL[14] // Read Receipt message is send to this
      :Organization  := TABMAIL[15] // "My Company Name"

      :TextBody      := Trim( TABMAIL[05] )

      IF LEN(ALLTRIM(TABMAIL[12])) > 0
         :HTMLBody   := MEMOREAD(TABMAIL[12])
      ENDIF

      If LEN(ALLTRIM(TABMAIL[06])) > 0
         :AddAttachment := AllTrim( TABMAIL[06] )
      ENDIF

      If LEN(TABMAIL[07]) > 0
         FOR nEle = 1 to LEN(TABMAIL[07])
            IF nEle = 1
               Dbcc := ALLTRIM(TABMAIL[07][1])
             ELSE
               DBCC := ALLTRIM(DBCC) + "," + ALLTRIM(TABMAIL[07][nEle])
            ENDIF
         NEXT
         :BCC := Trim(DBCC )
      EndIf

      :Send()

   End With
   SysRefresh()
   Catch oError
      MsgStop( "Envoi Message Impossible " + CRLF + "Erreur: " + cValToChar( oError:GenCode) + CRLF + ;
               "SubC: " + cValToChar( oError:SubCode ) + CRLF + "OSCode: " + cValToChar( oError:OsCode ) + CRLF + ;
               "SubSystem: " + cValToChar( oError:SubSystem ) + CRLF + "Message: " + oError:Description )

   oCfg := Nil
   oMsg := Nil
   Return( .F. )
End Try
oCfg := Nil
oMsg := Nil
SYSREFRESH()
Return( .T. )

 
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2944
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: MaxP and 48 guests