Results 1 to 34 of 34

Thread: Email Upload module (dead thread)

  1. #1
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Email Upload module (dead thread)

    I wrote a module for uploading files into tl_files via email.
    It should be pretty straightforward. Hope its useful

    Cheers, Murray.


    Edit 17 april 2012
    Now in Repository http://www.contao.org/en/extension-l...000009.en.html
    Support/instructions thread http://www.contao-community.org/view...hp?f=21&t=4063
    Issue with Macs fixed

  2. #2
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Email Upload module

    Me like :mrgreen:

    Uhm, I've built an upload method for Isotope. Could I in any easy way integrate part of your code (ER dependency or something) so that I can also have the system check the emailaddress? That way the website can inform the client the email has been received. Email limit (50mb) is larger then our current upload limit (16mb). (on the other hand, I could use ftp for upload)

  3. #3
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    Could I in any easy way integrate part of your code (ER dependency or something)
    Do with it as you wish. Its probably best to just put the appropriate code into your module (no ER dependancy)... or do you mean you'd like me to put something in mine?

  4. #4
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Email Upload module

    I haven't looked at your code, but if the emailcheck class/function can be created/executed another extension as well, then I don't want to add it myself, but like it to work together. Again, I haven't looked at your code, but like the possibilities!

  5. #5
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    I play guitar a bit, enough to knock out a tune to amuse myself.... but if i jam along with anyone they have to follow me, because i don't have enough skill to follow them.
    Programmings the same... the code works well enough (not graceful, but she goes)- but i'm damned if i know where to start to tie it in with other peoples stuff - i'm just not at that skill level.
    Its not really written modularly, or OOPly, and as i haven't yet begun to look at Isotope I wouldn't really know how to help you out Ruud.

    If you can specifically see something I can add into it to help you achieve this just let me know.

  6. #6
    Experienced user
    Join Date
    01-12-10.
    Posts
    814

    Default Re: Email Upload module

    I see. Well, you did manage to get this done and that is quite an achievement. I haven't tried it yet, but as the basis has been built I'm sure it just needs polishing.

    Just a random thing I noticed in your config.php:

    Code:
    if($GLOBALS['TL_CONFIG']['e_Up_pcs'] == 'hourly')
    {
    	$GLOBALS['TL_CRON']['hourly'][] = array('PollE_UpMailbox', 'pollTheE_UpMailbox');
    	
    }elseif($GLOBALS['TL_CONFIG']['e_Up_pcs'] == 'daily')
    {
    	$GLOBALS['TL_CRON']['daily'][] = array('PollE_UpMailbox', 'pollTheE_UpMailbox');
    	
    }elseif($GLOBALS['TL_CONFIG']['e_Up_pcs'] == 'weekly')
    {
    	$GLOBALS['TL_CRON']['weekly'][] = array('PollE_UpMailbox', 'pollTheE_UpMailbox');
    }
    You could replace that with either of the following alternatives that look nicer and are better practice:
    Code:
    //perhaps check for a correct value first? Depends on who inputs...
    $GLOBALS['TL_CRON'][$GLOBALS['TL_CONFIG']['e_Up_pcs']][] = array('PollE_UpMailbox', 'pollTheE_UpMailbox');
    or
    Code:
    switch ($GLOBALS['TL_CONFIG']['e_Up_pcs']) {
        case 'hourly':
            $GLOBALS['TL_CRON']['hourly'][] = array('PollE_UpMailbox', 'pollTheE_UpMailbox');
            break;
        case 'daily':
            $GLOBALS['TL_CRON']['daily'][] = array('PollE_UpMailbox', 'pollTheE_UpMailbox');
            break;
        case 'weekly':
            $GLOBALS['TL_CRON']['weekly'][] = array('PollE_UpMailbox', 'pollTheE_UpMailbox');
            break;
    }

  7. #7
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    yeah, i tend to use a lot of ifs (but no buts)
    Its a case of me switching to switch if i catch a break.
    (sorry, bit of programming humour there).
    old habits die hard as they say.

  8. #8
    New user
    Join Date
    04-21-11.
    Posts
    6

    Default Re: Email Upload module

    Hey ramjet,

    it seems, that your module would fulfill my needs
    but the connection to various mailboxes was always Unsuccessful!
    I have chosen an email adress on my website, one at gmx and made a new at googlemail (because of imap)
    but everytime it says Unsuccessful...
    I played with the ports and everything... but no chance
    Another thing also was, that in your settings form only email adresses are allowed as usernames but my confixx username dind't have an @ in its name...
    I've changed 'rgxp'=>'email' --> 'rgxp'=>'extnd' in tl_e_Up_settings.php
    then I could use my username...:D but it also didn't connect

    I hope u get it running... if u need some more details (logs etc.) I'm gonna help you out!

  9. #9
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    Hi t3g,
    can you find out the connection string your mailbox requires for connection?

    I certainly didn't realise you could have a mailbox without an @ symbol.

    At the moment you can configure to be Imap or Pop, and port, but its simple - so the connection string will either be
    {YOURMAILSERVERNAME/notls/imap:143}INBOX (143 - OR whatever port you give)
    or
    {YOURMAILSERVERNAME/pop3:110}INBOX (110 - OR whatever port you give)

    The /notls refers to do not encrypt ... gmail may require encryption ....

    To test GMAIL change line 101
    $serverCall = ($objSettings->isImap?'{'.$mailserver.'/notls/imap:'.$port.'}INBOX':'{'.$mailserver.'/pop3:'.$port.'}INBOX');
    to
    $serverCall = ($objSettings->isImap?'{'.$mailserver.':'.$port.'/imap/ssl/novalidate-cert}INBOX':'{'.$mailserver.':'.$port.'/pop3/ssl/novalidate-cert}INBOX');

    and try IMAP: imap.gmail.com as mailserver,993 as port, full email address as user and pass as pass
    or POP: pop.gmail.com as mailserver,995 as port, full email address as user and pass as pass


    if you remove the @ from in front of imap_open on line 111 of PollE_UpMailbox
    if($mbox = @imap_open($serverCall, $username, $password, CL_EXPUNGE))
    you may get an error message with furthur info (the @ suppresses any error messages)

    Don't forget too that the username of a mailbox is generally the whole email address (me@mydomain.com), not just the "me" part.

  10. #10
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    It also seems to me that Confixx should work (as is) if you use POP, enter no port (or 110), full email address as username, and not sure on mailserver name but possibly mail.YOURDOMAIN.COM - you'll need to ask your host, or your control panel should tell you.


    GMX should work (as is) too with
    POP mailserver: pop.gmx.com user: entire email address, port: none or 110 plus password
    or IMAP mailserver: imap.gmx.com user: entire email address, port: none or 143 plus password.

  11. #11
    New user
    Join Date
    04-21-11.
    Posts
    6

    Default Re: Email Upload module

    ramjet you rock
    thanks a lot!
    with confixx, I think it will not work, because my username is eg. web165p3 and not: uploads@... .com
    but I'm testing if it works with my edit, with the username not being an email adress...

    changing line 101 did the work
    it was because of encryption isn't it?

    I'm from Germany, so my gmx settings were: pop.gmx.de and port 995 (secured)... but they worked from the first time with the change in line 101

    and pop and imap on gmail worked flawlessly :D
    so thanks so much
    test emails worked as thay should

    ...next week, I'm gonna test few things about confixx (this would be my favorite way, gmail was worst,but I was happy, gmx now is better)

    so thanks so much and happy easter

  12. #12
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    cool, i'll redo the settings to include ssl or not to make it more flexible.
    let me know if you find out anything about confixx.

  13. #13
    New user
    Join Date
    04-21-11.
    Posts
    6

    Default Re: Email Upload module

    wohooop

    I did it

    now it works with confixx!
    after hours of research, I found out that there are 3!!! types of connecting, one without any security, one with starttls and one with ssl and that confixx uses notls. And in your original module the connection is made with starttls. You've showed me how to change it to ssl and I changed it with trial and error, a lot of googeling and with removing the @ in line 111 to notls

    so now my line 101 looks like:

    Code:
                    $serverCall = ($objSettings->isImap?'{'.$mailserver.'/notls/imap:'.$port.'}INBOX':'{'.$mailserver.'/pop3:'.$port.'/notls}INBOX');
    and now my connection works like a charm!
    for your info my settings are:

    Mail Server:
    mail.domain.extension

    Mailbox User Name:
    webXXXpY

    Mailbox Password:
    XXXXXXXXXXXXXXXXXX

    and no port number, so 110

    but, as you can see my username is no email adress (I have let my change with the email check)

    so now you could redo the settings once again and include notls also

    And I have a small suggestion :
    a checkbox would be cool to set if I want the Emails deleted, or not (if possible...)
    I don't know if this checkbox is good in the settings or in an upload entry

    so thank you so much for your module and your hard work and I hope I'll see it soon in the ER :D

    have a nice week!

  14. #14
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    Cool, and thanks.
    The trouble is that if the emails aren't deleted the script will poll and process them over and over - and take longer and longer to do so as the mailbox gets fuller.
    Maybe it could flag them as read and not process those, but I think this would be problematic, as if you read one before processing it would'nt be processed. What about a setting to forward them elsewhere after processing and before deletion? I'll think about this - as the mailbox is only for upload emails, not regular ones.
    Why do you want to keep them anyway ? - you will have the files in them on the server.

    PS: it'll take me a couple of weeks before I can look at this module again, and look deeper into the connection string requirements. Also re your German files - thats great, can you zip'em and upload here and i'll incorporate them.

  15. #15
    New user
    Join Date
    04-21-11.
    Posts
    6

    Default Re: Email Upload module

    You're welcome.
    Oh I see, I only thought about the emails, that don't fulfill the requirements...
    I wanted to have an option to see these later on... But it's not that important

    But I think one way could be to move the emails to another specified folder, which aren't processed with the correct subject, an email adress in the whitelist or don't have an attachment.
    Or yes you could forward these to the moderator for example...
    But for this, there's no hurry.

    Yes I attached the language files

  16. #16
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    I found some time .... Try this one to see if it works for you, I think (hope) it covers all possible connection types.
    One line to translate in the /de files ...
    $GLOBALS['TL_LANG']['tl_e_Up_settings']['use_ssl'] = array('Encryption Settings', 'Set SSL, NOTLS and NOVALIDATE_CERT if necessary');
    Just post translation here if you would

    See first post of this thread for updated zip file.

  17. #17
    New user
    Join Date
    04-21-11.
    Posts
    6

    Default Re: Email Upload module

    u are faster than light

    here is the translation

    Code:
    $GLOBALS['TL_LANG']['tl_e_Up_settings']['use_ssl']   = array('Verschlüsselungseinstellungen', 'Lege SSL, NOTLS und/oder NOVALIDATE_CERT fest, wenn nötig');
    thanks alot!

    edit:

    I had a problem but it was my fault, I didn't update the database :-P ;-)

    I've tested it with confixx and everything is fine!!!
    :-D

    as I said before, u rock ;-)

  18. #18
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,285

    Default Re: Email Upload module

    There is no need to use named entities for labels/translations, as long as the language files are encoded correctly in UTF-8 (without BOM)!
    Contao Community Moderator
    → Support options

  19. #19
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    Ah I was wondering what all that was.... trying to picture a German typewriter.
    I take it that theres no harm in it either xchs?

  20. #20
    Community-Moderator xchs's Avatar
    Join Date
    06-19-09.
    Posts
    1,285

    Default Re: Email Upload module

    No, there's no harm, but it is actually not necessary (as long as the language files are encoded according to Contao's standard scheme used everywhere in the core files).
    Contao Community Moderator
    → Support options

  21. #21
    New user
    Join Date
    04-21-11.
    Posts
    6

    Default Re: Email Upload module

    after a long time of usage of your great extension, I decided to correct the "umlauts" (&xxx
    back in April I didn't even know what utf-8 exactly was (my html edtor from back in 2002 didn't have the ability to read or write files in utf-8, but eclipse has )
    but now, I know a bit more about contao and so on...

    Your extension works without an error since april in productional use:D

    so cool:D

  22. #22
    New user
    Join Date
    02-25-10.
    Posts
    24

    Default Email Upload module - help requested

    Hi

    I have tried this great module, it works perfectly when uploading from a gmail account but not from my mac (mail application), it works from iphone, but the pict is copied in the folder upside down!!!! (I will need a pict manipulation module)
    Any idea why it does not work from mac (OSX 10.6.4)??
    Another question: is it possible to save a text between a special tag, my idea is to make an automated update of news with it, so I would need attachment and a text like for exemple: [up]The text to save[/up]

    Thanks for this good module anyway.

    R.

  23. #23
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    Thanks t3g, good to know.
    I'll test it against Contao 2.10 soon, and add the new german files in (and maybe even get round to using the repository)

    Remi, no idea re image orientation (ive not used a Mac or an iphone) however http://www.ehmac.ca/all-ios-iphone-i...sues-ios4.html may be a lead. Its likely that the email account software used (gmail?) does not interpret the exif data injected into the image by the iphone correctly when storing the attachment??? What is the image orientation of the attachment when you read it in the webmail client directly (before it is polled). How the web mail client sees it should be the same as how it ends up in tl_files after polling.

    Sorry I can't be of more help

    When you say it doesn't work from your Mac, what do you mean? Locally? The module reads web based mailboxes using php's IMAP functions. If the mailbox polled doesn't allow imap_open() then nothing will be read.

    Your idea to save text and update news would be possible (it wouldn't require a special tag, just text in the email body could be used - this module currently discards any body text) ... but it would require reasonably significant modification of this module away from its purpose (which is just to get files into tl_files securely via email). If you're a coder the best idea would probably be to use what i've done as the basis of a new module that saves the images into a specific folder and the text/timestamp/image paths directly into the News database tables.

    I have one I'm working on called Earthblog (that i haven't finished yet) that may be more easily modifiable to update news when its done (with just an alteration to the tables/fields used in the update statements). It essentially stores text and photos and a latlong from an email, and projects them onto google earth as blog entries. I'll keep in mind the idea of an Add to Earth/Add to News switch.

  24. #24
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    Latest, only change is it includes the new de language files.
    All good for Contao 2.10.x, also works on 2.9.x

    See first post of this thread for zip file.

  25. #25
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    Remi, i'll post it in a new thread ... but keep a lookout for a thread called "Email Blog Module".
    EDIT - here: http://www.contao-community.org/view...php?f=9&t=3493

    It may suit you, or be good to study if it doesn't suit.
    It doesn't add to News as such, but it allows you to set up "Blogs" and manually add entries or email entries (subject/text/photos) to them.
    I'll explain what is is and how to use it in that other thread when I post it over the next couple of days.

    It won't solve your upsidedown images/Mac issue though. I'd need more info on that.

  26. #26
    New user
    Join Date
    02-25-10.
    Posts
    24

    Default Re: Email Upload module

    Thanks Ramjet for your reply

    I will study your new module. This is a powerfull idea
    It would be great to activate some functionalities of the cms by email, I love this idea.
    for exemple publish / unpublish an article.

    Forget the orientation issue, this is a specific iphone deal I think.
    I will add a routine to rotate the image if I need it.

    I will spend more time to resolve my mac issue (the issue is sending from app. "Mail" using a Pop3 account).
    I can poll it from the server, however nothing is written in the folder. I is not so important at this time!

  27. #27
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    I've updated this one (the new zip file is in first post of this thread).
    Only minor - improvement to the look of Uploader and Moderator Notification emails, and to the Poll Mailbox report, which you can click directly through to the File Manager from each folder link.

    Theres no need to run the contao/install.php if you have previously installed it, as theres no database changes.

  28. #28
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Email Upload module

    This extension reads the e-mail and then posts to NEWS.

    viewtopic.php?f=21&t=3943

  29. #29
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    I've just updated this (zip file for manual install, and instructions are in the first post of this thread).
    I think I've solved the mac mail issue (attachments sent from mac mail did not upload), but I cannot easily test.
    It would be great if someone can test sending from Mac Mail, iphone, ipad etc and tell me if ok.
    I'll put it in the repository if it works (it should).

  30. #30
    New user
    Join Date
    02-25-10.
    Posts
    24

    Default Re: Email Upload module

    I will test it from MAC / IPHONE, ipad should be another user, I tell you more on monday

  31. #31
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    cheers Remi, much appreciated.

  32. #32
    Experienced user
    Join Date
    06-10-09.
    Location
    Cape Town, South Africa
    Posts
    1,387

    Default Re: Email Upload module

    If you give me an email address then I can send from my iPad. I think that the news reading module should somehow be dependant or integrated with this module...

  33. #33
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    Remi, that zip will probably count the number of attachments incorrectly - but at this stage I just need you to try with various filetypes to see if they all get uploaded and reported as successful - (so you'll need to have it set to all filetypes/no size restriction) and the filetypes you try will also need to be allowed in Contao:Settings:Upload file types

    If its easier for you, I can just pm you an upload address to send to (instead of setting up the module).

    I also think I've fixed the issue in the email blog module with the pairwith field, but we'll get this one going first as it relies on the same upload routine.

  34. #34
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: Email Upload module

    I'm confident it works with Mac/ipad/iphone now
    In Repository http://www.contao.org/en/extension-l...000009.en.html
    Support/instructions thread http://www.contao-community.org/view...hp?f=21&t=4063

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •