Solved

Mail Attchment with outlook?

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org (http://seleniumhq.org) Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
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 keystrokes in Netbeans IDE 8.0 for Windows.

708 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

14 Experts available now in Live!

Get 1:1 Help Now