Solved

Mail Attchment with outlook?

Posted on 2004-04-17
5
1,223 Views
Last Modified: 2013-12-26
Hi every body
I have used the following command to run outlook and make new message with subject and "TO"..etc.
The command is
run("rundll32 url.dll,FileProtocolHandler " + "mailto:a@b.com&subject=Hello")
It's run very nice ,but my problem is How to add to this command attachment to attach files.Any help ,I tried but I can't.
0
Comment
Question by:buty
  • 2
  • 2
5 Comments
 
LVL 15

Expert Comment

by:namasi_navaretnam
ID: 10849570
Checkout product PowerCube at http://www.beta2alpha.com

regards-
0
 
LVL 8

Expert Comment

by:gajender_99
ID: 10857533
hi here is the example in power builder how to send a mail from with attachment


//example

mailSession mSes
mailReturnCode mRet
mailMessage mMsg


//


// Create a mail session
mSes = create mailSession
// Log on to the session
mRet = mSes.mailLogon()
IF mRet <> mailReturnSuccess! THEN
MessageBox("Mail", 'Logon failed.')
RETURN
END IF
// Populate the mailMessage structure
If dw_report.dataobject='dr_arc_card' then
      mMsg.Subject = "Hello How are you" //+ "

     mMsg.NoteText = 'This is the body of mail  '  Auto Generated E-mail by the system'

mmsg.AttachmentFile[1].Filename='foot9.ico'
mmsg.AttachmentFile[1].Pathname='c:\'

mMsg.Recipient[1].name = 'gajender_99@hotmail.com'
mMsg.Recipient[2].name = 'gajender_99@yahoo.com'

// Send the mail
mRet = mSes.mailSend(mMsg)

IF mRet <> mailReturnSuccess! THEN
MessageBox("Mail Send", 'Mail not sent')
RETURN
END IF
mSes.mailLogoff()
DESTROY mSes
0
 
LVL 8

Expert Comment

by:gajender_99
ID: 10857538
hi just change

mMsg.NoteText = 'This is the body of mail  '  Auto Generated E-mail by the system'


to mMsg.NoteText = 'This is the body of mail ~nAuto Generated E-mail by the system'
0
 
LVL 15

Accepted Solution

by:
namasi_navaretnam earned 200 total points
ID: 10864276
See this link on how to use advanced outlook email features.

http://info.sybase.com/resolution/detail.stm?id_number=10864372

integer li_rc
long ll_pos_carriagereturn
string ls_recipients,ls_attachments,ls_subject,ls_body,ls_item
OLEObject loo_mycomponent,loo_myitem

SetPointer(HourGlass!)

ls_recipients = Trim(mle_recipients.Text)
ls_attachments = Trim(mle_attachments.Text)
ls_subject = Trim(mle_subject.Text)
ls_body = Trim(mle_body.Text)

loo_mycomponent = CREATE OLEObject
li_rc = loo_mycomponent.ConnectToNewObject("Outlook.Application")
IF li_rc <> 0 THEN
MessageBox("Connect Failed", "Retcode = " + String(li_rc))
RETURN
END IF

loo_myitem = loo_mycomponent.CreateItem(0)
loo_myitem.Display()

//Prepopulate Recipients
DO WHILE ls_recipients <> ""
ll_pos_carriagereturn = Pos(ls_recipients, "~r~n")
IF ll_pos_carriagereturn > 0 THEN
ls_item = Left(ls_recipients, ll_pos_carriagereturn - 1)
ls_recipients = Mid(ls_recipients, ll_pos_carriagereturn + 2)
ELSE
ls_item = ls_recipients
ls_recipients = "" 
END IF
loo_myitem.Recipients.Add(ls_item)
LOOP

//Prepopulate Attachments
DO WHILE ls_attachments <> ""
ll_pos_carriagereturn = Pos(ls_attachments, "~r~n")
IF ll_pos_carriagereturn > 0 THEN
ls_item = Left(ls_attachments, ll_pos_carriagereturn - 1)
ls_attachments = Mid(ls_attachments, ll_pos_carriagereturn + 2)
ELSE
ls_item = ls_attachments
ls_attachments = "" 
END IF
loo_myitem.Attachments.Add(ls_item)
LOOP

//Prepopulate Subject
loo_myitem.Subject = ls_subject

//Prepopulate Body
loo_myitem.Body = ls_body

//Set Options
loo_myitem.ReadReceiptRequested = TRUE

//Send Email
loo_myitem.Send()

//Cleanup
DESTROY loo_myitem

loo_mycomponent.DisconnectObject()
DESTROY loo_mycomponent

regards-
0
 

Expert Comment

by:pemurray
ID: 11907476
Gentlemen,

Thanks for the discussion on this topic.

I used the examples but was not able to send the attachment until I included the file name in the pathname as per the powerbuilder documentation.

mmsg.AttachmentFile[1].Filename='foot9.ico'
mmsg.AttachmentFile[1].Pathname='c:\foot9.ico'

Thanks again,

Paul
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
maven project import to eclipse problems 13 104
Eclipse versons - run configurations 2 85
eclipse apache tomcat admin console 52 94
JavaFX TableView not displaying correctly 3 16
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. …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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…

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now