×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    6

    Sending email in pys60

    Hello there,

    I know it may sound a bit 'noob-ish,' but does any of you know how to send emails from a S60 phone thru python? I tried inline modules (the same technique used in pyspy), I tried smtplib, I also tried sockets (the one featured in this forum) but to no avail.

    Any bits and pieces of information would definitely help me finish my project.

    Thanks very much!

  2. #2
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,777

    Re: Sending email in pys60

    Hi and welcome to the Python forum !

    Yes, you can send an email with Pys60, and whats more you can even send an email with an attachment !
    You can use the mmsmodule to do that for you.

    Here is how you can send the email

    Code:
    import mmsmodule
    mmsmodule.mms_send(u'EMAIL ADDRESS HERE',unicode("SUBJECT"),unicode("PATH OF FILE TO ATTACH"))
    Best Regards,
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  3. #3
    Registered User
    Join Date
    Feb 2008
    Posts
    6

    Re: Sending email in pys60

    Quote Originally Posted by croozeus View Post
    Hi and welcome to the Python forum !

    Yes, you can send an email with Pys60, and whats more you can even send an email with an attachment !
    You can use the mmsmodule to do that for you.

    Here is how you can send the email

    Code:
    import mmsmodule
    mmsmodule.mms_send(u'EMAIL ADDRESS HERE',unicode("SUBJECT"),unicode("PATH OF FILE TO ATTACH"))
    Best Regards,
    Croozeus
    Thanks very much for the info! This will definitely help me, but I've got a couple of questions to ask: Do I still have to include the attachment part? Or I can leave that out? Also, where can i put my message? Is it in the file itself?

    Thanks again!

  4. #4
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,777

    Re: Sending email in pys60

    Quote Originally Posted by resident_pessimist View Post
    Thanks very much for the info! This will definitely help me, but I've got a couple of questions to ask: Do I still have to include the attachment part? Or I can leave that out? Also, where can i put my message? Is it in the file itself?

    Thanks again!
    The code I gave was for attachments only. So you cannot leave out the attachment field. If you want to make that an MMS, just replace the email address by the mobile number.

    Moreover I have seen other modules like email_util which have a function to send email, however I have not used it myself.

    If I can remember correctly sendMail function in the email_util, so you will have to import like this

    from email_util import sendMail
    But again, I haven't tried that module yet.

    Best Regards,
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  5. #5
    Registered User
    Join Date
    Feb 2008
    Posts
    6

    Re: Sending email in pys60

    Hi croozeus,

    I tried the snippet but my device told me 'no module named mmsmodule.' How can I get it and how can I use the module in my application?

    I also have the same problem with smtplib. It seems the device can't see my modules eventhough smtplib.pyd (and pyc) are both copied on the same level as my application. Do I have to do anything for my device to see and use these modules?

    Thanks again for the guidance.

  6. #6
    Nokia Developer Moderator
    Join Date
    May 2007
    Location
    21.46 N 72.11 E
    Posts
    3,777

    Re: Sending email in pys60

    Quote Originally Posted by resident_pessimist View Post
    Hi croozeus,

    I tried the snippet but my device told me 'no module named mmsmodule.' How can I get it and how can I use the module in my application?

    I also have the same problem with smtplib. It seems the device can't see my modules eventhough smtplib.pyd (and pyc) are both copied on the same level as my application. Do I have to do anything for my device to see and use these modules?

    Thanks again for the guidance.
    Ah, How could I forget this, Actually this function has already been ported to the default messaging module, So you dont require to download mmsmodule and install it,

    Just use the messaging module for that.

    Code:
    messaging.mms_send(number,msg,attachment=None)
    Hope this helps,

    Best Regards,
    Croozeus
    Pankaj Nathani
    www.croozeus.com

  7. #7
    Registered User
    Join Date
    Feb 2008
    Posts
    6

    Re: Sending email in pys60

    This one's definitely a big help! So if I am to send an email, I just have to change the number to a valid email address. And If I want an attachment to come with my email, I just have to declare the path of my attachment in the 'attachment' parameter?

    Thanks croozeus!

  8. #8
    Registered User
    Join Date
    May 2009
    Posts
    19

    Re: Sending email in pys60

    Quote Originally Posted by resident_pessimist View Post
    This one's definitely a big help! So if I am to send an email, I just have to change the number to a valid email address. And If I want an attachment to come with my email, I just have to declare the path of my attachment in the 'attachment' parameter?

    Thanks croozeus!
    did you manage to sedn email (not mms) via python?
    I need to send email, is there a way to do so on nokia e60?

  9. #9
    Nokia Developer Moderator
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Sending email in pys60

    Quote Originally Posted by garnet2k View Post
    did you manage to sedn email (not mms) via python?
    I need to send email, is there a way to do so on nokia e60?
    Like resident_pessimist says, if you use mms_send and specify an email address instead of a phone number it will be sent as an email.

  10. #10
    Registered User
    Join Date
    May 2009
    Posts
    19

    Re: Sending email in pys60

    Quote Originally Posted by bogdan.galiceanu View Post
    Like resident_pessimist says, if you use mms_send and specify an email address instead of a phone number it will be sent as an email.
    aaah, ok. It worked. Just a thought here - it indeed sends it to an email address, BUT this is a billable event being an MMS. Now, is there a more generic way of sending email via python script? Something that will use data allowance and wont be, in majority of the cases, billable.

  11. #11
    Nokia Developer Moderator
    Join Date
    Oct 2007
    Location
    Deva, Romania
    Posts
    3,471

    Re: Sending email in pys60

    Not that I know of. This is the only official method, and I don't know if there are any workarounds or C++ extensions for it.

  12. #12
    Registered User
    Join Date
    May 2009
    Posts
    19

    Re: Sending email in pys60

    Quote Originally Posted by bogdan.galiceanu View Post
    Not that I know of. This is the only official method, and I don't know if there are any workarounds or C++ extensions for it.
    Strange indeed. If this is true, it puts at least one major limitation: you cant not attach anything alse than multimedia files, i.e. txt file wont work. It sends the MMS, but put a note that the txt is removed.
    Any ideas?
    Last edited by garnet2k; 2011-04-07 at 09:25.

  13. #13
    Registered User
    Join Date
    May 2009
    Posts
    19

    Re: Sending email in pys60

    Quote Originally Posted by bogdan.galiceanu View Post
    Not that I know of. This is the only official method, and I don't know if there are any workarounds or C++ extensions for it.
    I have found a way round it. If someone is interested I will post the necessery python modules and the description.
    The end result is you can send email with attachments, using your wifi/3g/gprs connection.
    Let me know.

  14. #14
    Registered User
    Join Date
    Mar 2003
    Posts
    1

    Re: Sending email in pys60

    Hi, I am interested to know how you can send emails over WiFi/3G/GPRS using PyS60.

  15. #15
    Registered User
    Join Date
    May 2009
    Posts
    19

    Re: Sending email in pys60

    here are the modules
    http://www.4shared.com/file/mzNCJ7sT/smtp.html

    what you neet to do is:
    get them all in one folder on your PC
    name your actual py program default and put it in same folder
    in your program you can call it like
    PHP Code:
    import attchmail as 
    and then
    PHP Code:
    a.mail(sender='something@some.com'to=something@some.comsubject='test'text='test'attachments=['optinal file location on your phone']) 

Similar Threads

  1. Sending email from E61 S60 3rd edition phone
    By waynej2 in forum Mobile Java General
    Replies: 1
    Last Post: 2007-09-13, 21:18
  2. Replies: 1
    Last Post: 2006-08-18, 09:03
  3. How to set default access point for sending email using RSendAs?
    By xhsoldier in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2006-08-15, 09:07
  4. Sending a remote email
    By Brucmack in forum Symbian C++
    Replies: 0
    Last Post: 2005-11-10, 09:37
  5. Sending Email over GPRS
    By pankajmahto in forum Symbian C++
    Replies: 0
    Last Post: 2004-07-29, 07:48

Posting Permissions

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