Bart
Member
Registered: 19th Aug 02
Location: Midsomer Norton, Bristol Avon
User status: Offline
|
Im not sure if what im trying to do is possible, hopefully someone can point me in the righ direction.
Id like a mailto link which adds an attachment from the server side.
I understand this isnt possible in normal HTML code, but can it be done via php/java etc?
The email must be populated in the default email client.
Adam
|
ed
Member
Registered: 10th Sep 03
User status: Offline
|
Not possible, all PHP or any server side scripting language does is output something the browser can use (i.e. HTML, JS, a PDF, and image e.t.c.). What you're wanting to do would need access to the file system - web browsers are sandboxed from the file system for security reasons so you can't do much with local files.
|
Bart
Member
Registered: 19th Aug 02
Location: Midsomer Norton, Bristol Avon
User status: Offline
|
thanks Ed, so theres no way what so ever to attach a file to the default email client?
|
AndyKent
Member
Registered: 3rd Sep 05
User status: Offline
|
What do you want to attach? Or more importantly why?
|
Bart
Member
Registered: 19th Aug 02
Location: Midsomer Norton, Bristol Avon
User status: Offline
|
I have a purchase order system which works well.
At the end of the process (creating the purchase order), the user has two options, one to email directly to the supplier (an email address associated with the supplier and this works well) or another option generates a PDF (this also works).
But if the user wants to send the PDF to an email address not associated with the supplier, they have to save the PDF locally then attach to the email client.
Id like to attach the exported PDF (which gets saved locally to a temp folder when created) to the default email client and allow them to send to a different address.
I dont want to do it through php as the users have all their addresses in outlook.
|
AndyKent
Member
Registered: 3rd Sep 05
User status: Offline
|
Only way round it I can think of would be to store the PDF in a publicly available folder on your server which you can offer a hyperlink to. Mailto can contain the direct link which your customer forwards on.
Opens up no end of other admin problems though obviously.
|
Sam
Moderator Premium Member
Registered: 24th Dec 99
Location: West Midlands
User status: Offline
|
With my accounts system, it comes up with a window where I can preview a PDF of an invoice or whatever and then I can email that PDF from within that window to someone, with the PDF attached.
Can you not do this instead of using the end user's own email client?
|
ed
Member
Registered: 10th Sep 03
User status: Offline
|
Could do as Andy mentioned, but keep the PDF's in a private directory. Your e-mail could contain a link to a PHP page which verifies a hash in the URL so it can only be opened by people with the official link (along the lines of Google Docs). If you salt the hash then you can break all the links by changing the salt value.
|
Dom
Member
Registered: 13th Sep 03
User status: Offline
|
Use server-side for email or as mentioned embed a link to the file in the message, only options you've got.
|
Bart
Member
Registered: 19th Aug 02
Location: Midsomer Norton, Bristol Avon
User status: Offline
|
I thought about the mailto with a link, but wasnt keen on the idea and it relies on someone the other end having to click through to download.
quote: Originally posted by Sam
With my accounts system, it comes up with a window where I can preview a PDF of an invoice or whatever and then I can email that PDF from within that window to someone, with the PDF attached.
Can you not do this instead of using the end user's own email client?
Is this done via Adobe? Ive just tried this and whilst it works fine, its quite long winded and involves alot of clicking.
|
Sam
Moderator Premium Member
Registered: 24th Dec 99
Location: West Midlands
User status: Offline
|
The PDF is embedded in the window, but when I click the Send button I imagine there is a physical PDF file that the PHP scripts sends as an email attachment to whatever email address I specify in that same window.
I don't think it's long winded - your other option involves the user saving the PDF to their computer and then making several clicks to send the email along with the downloaded file. The way my accounts system does it involves one click.
The email address field is already populated with an address I entered for the customer when I set their account up, and that can be manually overridden.
[Edited on 28-03-2012 by Sam]
|
Bart
Member
Registered: 19th Aug 02
Location: Midsomer Norton, Bristol Avon
User status: Offline
|
quote: Originally posted by Sam
The PDF is embedded in the window, but when I click the Send button I imagine there is a physical PDF file that the PHP scripts sends as an email attachment to whatever email address I specify in that same window.
This is easily achievable, however you dont have access to your outlook address book built into that input box?
|
Dom
Member
Registered: 13th Sep 03
User status: Offline
|
quote: Originally posted by Bart
quote: Originally posted by Sam
The PDF is embedded in the window, but when I click the Send button I imagine there is a physical PDF file that the PHP scripts sends as an email attachment to whatever email address I specify in that same window.
This is easily achievable, however you dont have access to your outlook address book built into that input box?
You can access the Address Book via javascript/activeX although it's limited to IE only.
|
ed
Member
Registered: 10th Sep 03
User status: Offline
|
That's smart, didn't know you could do that
http://stackoverflow.com/questions/5336975/import-contacts-from-outlook-with-js
|
ed
Member
Registered: 10th Sep 03
User status: Offline
|
Also, if you're going to be sending mail from PHP, I recommend this class:
http://code.google.com/a/apache-extras.org/p/phpmailer/
|
Sam
Moderator Premium Member
Registered: 24th Dec 99
Location: West Midlands
User status: Offline
|
quote: Originally posted by Dom
You can access the Address Book via javascript/activeX although it's limited to browsers with massive security holes like IE.
EFT
|
Dom
Member
Registered: 13th Sep 03
User status: Offline
|
PHPMailer is useful if you're doing anything advanced, especially working with headers/attachments, otherwise i find it a bit OTT for basic mail tasks. Pear mail is another to look at as well.
Sam - IE is relatively secure, more so than mozilla based browsers going by recent reports. It's third-party plugins that tend to be the security issue when using IE.
Edit - From what i remember there is an Attachment method/property with the Outlooks activex object, need to double check though as it's been a while since i've look at it. Again, this is all IE-only.
[Edited on 28-03-2012 by Dom]
|
Bart
Member
Registered: 19th Aug 02
Location: Midsomer Norton, Bristol Avon
User status: Offline
|
with phpmailer, are we still talking about using the default email client or sending email via php?
I dont have an issue with the latter.
|
Sam
Moderator Premium Member
Registered: 24th Dec 99
Location: West Midlands
User status: Offline
|
Via PHP.
|
ed
Member
Registered: 10th Sep 03
User status: Offline
|
Via PHP - just makes it a piece o'piss to attach files and send both plain text and HTML e-mails at the same time
|
Bart
Member
Registered: 19th Aug 02
Location: Midsomer Norton, Bristol Avon
User status: Offline
|
as stated above, we're already doing this, it works well!
But not all orders will want to go directly to the supplier, someone may want email to a different address other than the one associated on the account, which would be easier to use their email client.
I think i'll have to admit defeat
|
ed
Member
Registered: 10th Sep 03
User status: Offline
|
Where are the address books stored? Is it an Exchange server, Google Apps or some other online thing? API connection?
If it's local, then that idea wont work.
|
Dom
Member
Registered: 13th Sep 03
User status: Offline
|
Similar to what Ed said, you also have LDAP access via PHP (look at OpenLDAP etc) and from what i remember you can access address books that way. Obviously this would be internal use only and you'd have to authenticate the user with the domain, but it could be another solution.
|
Bart
Member
Registered: 19th Aug 02
Location: Midsomer Norton, Bristol Avon
User status: Offline
|
address books are stored within exchange.
What does OpenLDAP offer? Is it active directory access from the outside world?
|
Dom
Member
Registered: 13th Sep 03
User status: Offline
|
It'll give you LDAP access to AD; although i can't honestly remember if you're able to to get Exchange contacts. You'd need to do some research on this. You also have WebDav, which i believe allows access to Exchange contacts but i know sweet FA about this so you'd need to look it up.
Edit - This may help; HERE
[Edited on 28-03-2012 by Dom]
|