Skip to main content
JBWebWorks
Inspiring
August 22, 2008
Question

asp to PHP

  • August 22, 2008
  • 1 reply
  • 572 views
I use Dreamweaver CS3 and have an email extension from WebAssist

My problem is sending email file attachments with PHP. I have been using ASP and am switching to PHP.
this is the code for the email file attachment that works in ASP
WA_MailObject = WAUE_AddAttachment(WA_MailObject,"" & cStr(Server.MapPath("/PDF")) & "\200LX.pdf")

I can't seem to translate to PHP and get it to work. What would the PHP equivalent be for
& cStr(Server.MapPath("/PDF")) & "\200LX.pdf")

thanks
for any help
This topic has been closed for replies.

1 reply

Inspiring
August 23, 2008
JBWebWorks wrote:
> What would the PHP
> equivalent be for
> & cStr(Server.MapPath("/PDF")) & "\200LX.pdf")

There isn't one. The PHP mail() function does not support attachments.

To send attachments with mail by PHP, you need to use a PHP class. There
are several about: PEAR Mail and Mail_Mime, the Zend Framework,
phpMailer, etc.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
JBWebWorks
Inspiring
August 24, 2008
Thanks David.

I found out something i was doing wrong with the WebAssist emailer; the file i want to send as an attachment is in the same folder as the page sending the email. I had put in the path as /PDF/200LX.pdf when it should be just 200LX.pdf. So the PHP code became
$WA_MailObject = WAUE_AddAttachment($WA_MailObject,"200LX.pdf"); //which works
instead of
$WA_MailObject = WAUE_AddAttachment($WA_MailObject,"/PDF/200LX.pdf"); //which doesn't work

A different problem now
The email sends but the attachment comes in .dat versus the .pdf
I have googled the poblem and find that it is a known problem but information gears toward Outlook.
Can't find anything about server generated emails.

Any suggestions?

PS- I like your books