?
Solved

Mail Attchment with outlook?

Posted on 2004-04-17
5
Medium Priority
?
1,262 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
[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
  • 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 800 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

770 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