?
Solved

Sending Multiple Attachments Via Outlook / Powerbuilder

Posted on 2004-08-27
2
Medium Priority
?
2,112 Views
Last Modified: 2013-12-26
Hi All,

I have succeeded in getting Powerbuilder to send an attachment but I would like to be able to send more than one attachment and am hoping to get an example of how it is done.

Here is my current code:

mailSession mSes

mailReturnCode mRet
mailMessage mMsg
mailFileDescription mAttach

mMsg.Recipient[1].name = 'paulericmurray@hotmail.com'
mMsg.Recipient[1].RecipientType = mailTo!
mMsg.Recipient[2].name = 'pemurray@groundtravel.com'
mMsg.Recipient[2].RecipientType      = mailCC!

mAttach.Filename = Apollo.doc'
mAttach.Pathname = 'T:\Apollo.doc'
mAttach.FileType = mailAttach!
//mAttach.Position = 1

mMsg.Subject = 'Test Message'
mMsg.NoteText = 'This is the body of mail ~nAuto Generated E-mail by the system'

// Create a mail session
mSes = CREATE mailSession
// Log on to the session
//mRet = mSes.mailLogon(mailNewSession!)

mRet = mSes.mailLogon()
IF mRet <> mailReturnSuccess! THEN
     MessageBox("Mail", 'Logon failed.')
     RETURN
END IF

mMsg.AttachmentFile[1] = mAttach
IF mRet <> mailReturnSuccess! THEN
     MessageBox("Mail", 'Attachment failed.')
     RETURN
END IF

mRet = mSes.mailAddress(mMsg)
IF mRet <> mailReturnSuccess! THEN
     MessageBox("Mail", 'Addressing failed.')
     RETURN
END IF

// Send the mail
mRet = mSes.mailSend(mMsg)
IF mRet <> mailReturnSuccess! THEN
     MessageBox("Mail", 'Sending mail failed.')
        MessageBox("Mail", String(mRet))

string mailreturnstring
        
        mailreturnstring = MailErrorToString(mRet)
        MessageBox("Email Result", "Email ReturnCode = " + mailreturnstring)
     RETURN
END IF

mSes.mailLogoff()
DESTROY mSes

Thank you,

Paul
0
Comment
Question by:pemurray
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 33

Accepted Solution

by:
sajuks earned 2000 total points
ID: 11920068
//Try this eg:
mailsession lms_sess
mailmessage lm_mess
mailrecipient lm_recipient
mailFileDescription lmf_file
mailreturncode lmc_rc

lmf_file.FileType = mailAttach!
lmf_file.FileName = "212.txt"
lmf_file.PathName = "c:\" + "212.txt"

lm_mess.NoteText = "this my report."
lm_mess.Subject = "report "
lmf_file.Position = 1
lm_mess.Attachmentfile[1] = lmf_file



lmf_file.FileType = mailAttach!
lmf_file.FileName = "jsp.txt"
lmf_file.PathName = "c:\" + "jsp.txt"
lmf_file.Position = 2
lm_mess.Attachmentfile[2] = lmf_file

lm_recipient.Address = "my@email.com"
lm_recipient.Name = "My Name"
lm_recipient.RecipientType = mailTo!
lm_mess.Recipient[1] = lm_recipient

lms_sess = create mailsession
lmc_rc = lms_sess.mailLogon()
lmc_rc = lms_sess.mailSend(lm_mess)
IF lmc_rc <> mailReturnSuccess! THEN
        MessageBox("Error", "Error on Send")
END IF

lmc_rc = lms_sess.mailLogoff()
DESTROY lms_sess

 


0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses
Course of the Month8 days, 22 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question