View Full Version : Sending E-mail from AIR?
fx.barrett
03-07-2009, 07:28 PM
I'm quite sure this is not possible without the help of a server-side language but I want to be 100% sure that I'm correct. So, is it possible to send e-mail with attachments from within AIR only or do I need PHP to help me out ?
evride
03-08-2009, 03:53 AM
i'd suggest PHP, but you can use a socket side server. Just connect to a SMTP server and find out what commands to use for the SMTP server.
Note: This would require that any software firewalls on the computer allow you to send data out to a smtp server (port 25). I believe in most cases it would be open as some firewalls only block incoming traffic AND the port might be open already for other email programs (Thunderbird, Outlook).
fx.barrett
03-08-2009, 08:27 AM
Thanks evride for the reply, could you tell me one more thing ? I'm a bit new to AIR but not to the whole thing and I didn't have the time to test if I call a PHP file from a local directory, would it behave as if it were on the net ( my common sense tells me "no", but I want to be sure ). If not, then I'm guessing that my .php script would reside on a domain and I'd connect to it from ai that way, correct ?
szataniol
03-08-2009, 05:17 PM
You can do it in pure as3. :) Check out SMTP Mailer, developed by guys from bytesrray.org
fx.barrett
03-08-2009, 05:25 PM
You can do it in pure as3. :) Check out SMTP Mailer, developed by guys from bytesrray.org
Thanks, I'll check it out right away. ;)
EDIT: anyway, I solved the problem before by creating a .php script on one of my web domains but I'll definitely check out the bytearray library too.
saravanan
03-11-2009, 07:35 PM
I tried using it but its not working ??
was that worked for any one ?
-sara
www.designscripting.com
EndlessLine
03-12-2009, 04:08 PM
I've got it setup using PHP. Didn't know it was possible with AS3 only. How does it actually send the mail? I'd be interested to hear how that goes down. I've got my current app setup with Weborb/Cairngorm and the mail setup took about 5 minutes to get running but it would be nice to be able to create simple mailers without having to setup so much framework.
evride
03-12-2009, 09:36 PM
endlessline: it uses the Socket class
EndlessLine
03-12-2009, 10:54 PM
ah cool, i'll have to check that out thanks
fx.barrett
03-13-2009, 08:47 AM
Yeah, I too took the PHP + Cairngorm aproach. It's working well.
EDIT: fast question. I'm not a PHP guru so I don't know if there's a better solution ( tried surfing for one but not with much successs ). How do you guys handle the reading process of a local file in PHP ? Let's say I create a FileReference list in Flex, use browse to select some files. How would PHP read their content and return it back to Flex ?
What I did was to upload the files, read each file's content and store it in an array -> delete the uploaded files and send the array to Flex. This is a solution but it's not a really efficient one in my opinion. What if 1000 users are using the same app at the same time and 60% of them is uploading a file with the same name. In theory, this would trigger some sort of an error since 600 people would be constantly overwriting a file and who knows what would they get in return...
I thought of maybe naming the file by using up their IP and current date, that way, there's an extremely low chance for the above problem to occur. But still, I don't consider this a too great solution either. Isn't it possible to somehow upload the file into the memory and read it from there, send the data back to Flex and afterward clean the memory.
Or how would you guys solve this with PHP ? Thanks.
saravanan
03-24-2009, 07:42 PM
Any working example of using socket class.. i tried many times but never got it working..
-sara
www.designscripting.com
evride
03-24-2009, 08:14 PM
yes.
http://www.gotoandlearn.com/play?id=69
corbo950
03-26-2009, 10:58 PM
i tried his tutorial and my server responds when i first connect but as soon as i try to respond(send the username) i never get an answer.... i even tried doing it in flash instead of flex like the tutorial and wrote it letter of letter like he did and it still doesn't answer after the first "+OK POP3 server ready" that... any ideas why?
evride
03-27-2009, 02:21 AM
maybe check your specific email server documentation.
corbo950
03-27-2009, 08:15 PM
ya but if that was wrong then i wouldnt have gotten the first answer would i have?
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.