[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1297
  • Last Modified:

Mail Attchment with outlook?

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
buty
Asked:
buty
  • 2
  • 2
1 Solution
 
namasi_navaretnamCommented:
Checkout product PowerCube at http://www.beta2alpha.com

regards-
0
 
gajender_99Commented:
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
 
gajender_99Commented:
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
 
namasi_navaretnamCommented:
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
 
pemurrayCommented:
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 Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now