Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

email problem

Status
Not open for further replies.

fluppe689

Programmer
Jul 11, 2008
75
0
0
BE
Dear experts,

I have 2 problems.

problem 1 how to fill up the body of an email with a memo field from a foxpro table.

problem 2 how to send the signature of the user also in this body

wfg,
 
How are you sending the email? Are you using Automation? If so, which application? Outlook? Are you using CDO? Or a third-party function like Blatt? Or ShellExecute? Or what?

Give us the info and we'll try to answer your question.

Mike




__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
hello mike,

this is my code
*-------------------------------------
PROCEDURE print_offer
PARAMETER utprtype,utoffnr,utemail,uttaal
*-------------------------------------
*
*
SELECT * FROM f_offglo, f_offdet, f_adres;
WHERE f_offglo.nummer = utoffnr;
AND f_offdet.nummer = f_offglo.nummer;
AND f_adres.TYPE = f_offglo.TYPE;
AND f_adres.nr = f_offglo.nr;
INTO CURSOR tmpcroff READWRITE;
ORDER BY f_offdet.nummer,f_offdet.volgnr
GO TOP
SELECT tmpcroff
GO TOP

*
SET SAFETY off
COPY TO c:\foxprow\ofprint.DBF TYPE FOXPLUS
SET SAFETY ON

IF utprtype=2
DO FORM frmprev.scx WITH "offerte.rpt"
ENDIF
IF utprtype=1
oCRApp = CREATEOBJECT("crystalruntime.application")
oRep = oCRApp.OpenReport("p:\merlijn\offerte.rpt")
oRep.printersetup(0)
oRep.printout(.T.,1,.T.)
ENDIF
IF utprtype=3
m.xxmail=ALLTRIM(utemail)
m.xxattach="p:\merlijn\offertes\"+ALLTRIM(STR(utoffnr,10,0))+".PDF"
m.xxattach1="p:\Standaarddocumenten\Werkdocumenten\NAMGRASSvoorwaarden.pdf"

xxattach=m.xxattach
IF FILE (m.xxattach)
DELETE FILE &xxattach
ENDIF
oCRApp = CREATEOBJECT("crystalruntime.application")
oRep = oCRApp.OpenReport("p:\merlijn\offerte.rpt")
oExport = oRep.Exportoptions()
oExport.Destinationtype = 1
oExport.FormatType = 31
oExport.Diskfilename = "&xxattach"
oRep.EXPORT(.F.)
IF uttaal = "F"
m.xxsubject ="OFFRE NAMGRASS"
* m.xxbody = alltrim(tmpcroff.mailtekst)
m.xxbody ="Chèr Monsieur, Madame,"+CHR(13)+CHR(10)+CHR(13)+CHR(10)+ "Suite à votre demande de prix, nous avons le plaisir de vous envoyer en annexe votre offre de prix."+CHR(13)+CHR(10)+;
+CHR(13)+CHR(10) +"Toujours à votre disposition pour de plus amples informations."+CHR(13)+CHR(10)+;
+CHR(13)+CHR(10) +"Veuillez agréer, madame, monsieurs, nos salutations distinguées."+CHR(13)+CHR(10)+"Service des ventes"
else
m.xxsubject ="OFFERTE NAMGRASS"
* m.xxbody = alltrim(tmpcroff.mailtekst)
m.xxbody ="Geachte,"+CHR(13)+CHR(10)+CHR(13)+CHR(10)+ "Naar aanleiding van uw prijsvraag hebben wij het genoegen u in bijlage uw offerte te laten geworden."+CHR(13)+CHR(10)+;
+CHR(13)+CHR(10) +"Steeds tot uw dienst voor bijkomende inlichtingen."+CHR(13)+CHR(10)+;
+CHR(13)+CHR(10) +"Met vriendelijke groeten,"+CHR(13)+CHR(10)+"Het Verkoopsteam"
ENDIF

o=CREATEOBJECT("outlook.application")
TRY
oitem = o.createitem(0)
CATCH TO loException WHEN INLIST(loException.ERRORNO,1427,1429)
* Messagebox(loException.Details)
* or
MESSAGEBOX("You didn't allow this program to use outlook or outlook isn't open, please try again",0,"this program")
ENDTRY

o=CREATEOBJECT("outlook.application")
oitem = o.createitem(0)
oitem.subject = m.xxsubject
oitem.TO = utemail
oitem.cc = ''
oitem.bcc = ''
oitem.body = m.xxbody
oitem.display()
oitem.Attachments.ADD("&xxattach")
oitem.Attachments.ADD("&xxattach1")
*
oitem.DISPLAY
o=.NULL.

ENDIF


I would like to that m.xxbody = alltrim(tmpcroff.mailtekst)
tmpcroff.mailtekst is a memo field

wfg,

Filip
 
Filip,

Maybe I'm missing something but you have the line
Code:
*        m.xxbody        =    alltrim(tmpcroff.mailtekst)
commented (starred) out followed by the line
Code:
m.xxbody        ="Geachte,"+CHR(13)+CHR(10)+CHR(13)+CHR(10)+ "Naar.....
(or the French version).

Otherwise I can't see a problem with the way you have it.

I'm sorry I don't know the answer to getting the signature in to the body, but I seem to remember that question on this forum not long ago.

Hope that helps,

Stewart
 
I agree with Stewart. If you want the contents of xxbody to appear in the body of the email, your code should work OK.

Whether it was originally a memo field or not is irrelevant.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Looked more like a German to me - may be also Dutch.
 
Actually, this

m.xxbody ="Geachte,"+CHR(13)+CHR(10)+CHR(13)+CHR(10)+ "Naar aanleiding van uw prijsvraag hebben wij het genoegen u in bijlage uw offerte te laten geworden."+CHR(13)+CHR(10)+; +CHR(13)+CHR(10) +"Steeds tot uw dienst voor bijkomende inlichtingen."+CHR(13)+CHR(10)+; +CHR(13)+CHR(10) +"Met vriendelijke groeten,"+CHR(13)+CHR(10)+"Het Verkoopsteam"

I don't think it's a German.
 
As I'm from Holland I would say that the text is partly in French and partly in Flemish (=Belgian Dutch) which is very close to Dutch language.

-Bart

 
Mike,

You need to be Dutch or Flemish to be able to distinguish :)
It's just the way things are said. Belgiums in normalhave for almost everything 'Dutch' words as well in stead of English.

-Bart
 
for the signature you need to

oitem.display()

before you do

oitem.body = m.xxbody

the signature doesn't get included till the message is displayed (or sent) and by assigning the body beforehand you prevent the signature being added.
In theory you could find the path to the default signature in the registry but ....

hth
nigel
 
You need to be Dutch or Flemish to be able to distinguish

I'm sure that's right, Bart. It's not like hearing the difference between French French and Belgian French.

I've also always wondered why, when you speak English to Flemish-speakers, they always refer to their language as Dutch; they seldom use the word Flemish in English. But in Flemish, they presumably don't refer to the language as Nederlands. I was taught to to say Vlaams.

(Sorry this is off-topic now.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Ok Guys,

I am Flemisch, but the point is that my memo field
alltrim(tmpcroff.mailtekst) doesn't work in the body of the mail.

wfg,
Filip,
The flemisch one
 
Sorry Filip, didn't mean to set off a load of comments. I was saying "or the French version" because I noticed that you had an IF...ELSE...ENDIF with different languages in each part.

So you starred out the line m.xxbody = alltrim(tmpcroff.mailtekst) to test what was going on?

Does that command actually put the contents of the memo field into the variable xxbody?

If so, what then happens when you set oitem.body = m.xxbody?

Stewart
 
I am Flemisch, but the point is that my memo field
alltrim(tmpcroff.mailtekst) doesn't work in the body of the mail.

My apologies too. I know how annoying it is to ask a sensible question and then see the thread cluttered with irrelevant comments.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Filip, your question was already answered.

You now have
Code:
*        m.xxbody        =    alltrim(tmpcroff.mailtekst)
        m.xxbody        ="Geachte,"+CHR(13)+CHR(10)+CHR(13)+CHR(10)+ "Naar aanleiding van uw prijsvraag hebben wij het genoegen u in bijlage uw offerte te laten geworden."+CHR(13)+CHR(10)+;
        +CHR(13)+CHR(10) +"Steeds tot uw dienst voor bijkomende inlichtingen."+CHR(13)+CHR(10)+;
        +CHR(13)+CHR(10) +"Met vriendelijke groeten,"+CHR(13)+CHR(10)+"Het Verkoopsteam"

which does hardcode a certain text, if you want the memo field as mailtext you need:

Code:
        m.xxbody        =    alltrim(tmpcroff.mailtekst)
*        m.xxbody        ="Geachte,"+CHR(13)+CHR(10)+CHR(13)+CHR(10)+ "Naar aanleiding van uw prijsvraag hebben wij het genoegen u in bijlage uw offerte te laten geworden."+CHR(13)+CHR(10)+;
        +CHR(13)+CHR(10) +"Steeds tot uw dienst voor bijkomende inlichtingen."+CHR(13)+CHR(10)+;
        +CHR(13)+CHR(10) +"Met vriendelijke groeten,"+CHR(13)+CHR(10)+"Het Verkoopsteam"

Regarding the mail signature Nigel has given the right answer, that you need to display the mail item with oitem.display() before setting the body, so you just need to switch those two lines of your code.

If that does not work, then please describe, what happens, what errors you get or whatever is not as expected. No reaction is generally interpreted as problem solved or abondoned.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top