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
Solved

Mail Attchment with outlook?

Posted on 2004-04-17
5
1,231 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

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. …
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
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 use and create new code templates in NetBeans IDE 8.0 for Windows.

837 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