corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » PHP/HTML Geeks...


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author PHP/HTML Geeks...
Bart
Member

Registered: 19th Aug 02
Location: Midsomer Norton, Bristol Avon
User status: Offline
28th Mar 12 at 06:47   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 07:53   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 08:01   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 08:02   View User's Profile U2U Member Reply With Quote

What do you want to attach? Or more importantly why?
Bart
Member

Registered: 19th Aug 02
Location: Midsomer Norton, Bristol Avon
User status: Offline
28th Mar 12 at 08:04   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 08:10   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 08:17   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 08:19   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 09:00   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 09:02   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 09:12   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 10:54   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 11:46   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 12:18   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 12:20   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 12:21   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 12:27   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 12:41   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 12:51   View User's Profile U2U Member Reply With Quote

Via PHP.
ed
Member

Registered: 10th Sep 03
User status: Offline
28th Mar 12 at 12:57   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 13:00   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 13:18   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 13:38   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 14:13   View User's Profile U2U Member Reply With Quote

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
28th Mar 12 at 15:43   View User's Profile U2U Member Reply With Quote

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]

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
Young wippersnappers - Website tutourials wanted. Daimo B Geek Day 28 2360
8th Dec 06 at 14:24
by Cybermonkey
 
Dodgy HTML/PHP/Table problem liamC Geek Day 9 788
24th Jan 07 at 19:37
by liamC
 
Web wiz Basscrazy Geek Day 6 655
31st Jan 07 at 01:33
by drax
 
PHP Popup Window liamC Geek Day 3 1306
1st Apr 07 at 23:07
by Steve
 

Corsa Sport » Message Board » Off Day » Geek Day » PHP/HTML Geeks... 29 database queries in 0.0163760 seconds