Results 1 to 20 of 20

Thread: Sending mail - problem with authentication

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Sending mail - problem with authentication

    "bad people" can use your login and password to send thousands of emails to people. This can happen until your account is banned.

    If you create your own SMTP server, it will be free of charge if you host it yourself on your own connection, else you need to shop around. It can be expensive.

  2. #2
    Join Date
    Feb 2010
    Posts
    68
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Sending mail - problem with authentication

    If I host my own SMTP server, can't they use it knowing my login data (fetched from my program)? And how can I accept mails only from one specified e-mail adress? Is this a kind of property of an SMTP server?

  3. #3
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Sending mail - problem with authentication

    If you hosted your own SMTP server, it would be impractical for other people to use it, as it would only ever accept mail to local addresses to itself (where there might only be one), so other people just wouldn't bother.

    Spammers are only interested in "open" mail servers - those which will accept mail destined for anywhere. As soon as your mail server rejects all non-local mail, people lose interest very quickly and go find some other mail server. This is the typical mail server configuration.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Sending mail - problem with authentication

    I think bringing up your own mail server is an overkill here. A solution with the end-user providing authentication data to the application is much better. A not so bad alternative is to embed some of the capabilities of an smtp server directly into your application. Actually what is required besides what the client side of smtp offers is an ability to query dns for an MX record for a particular destination address. When you connect to the appropriate server, it won't require you to authenticate yourself (i.e. you don't need to authorize to poczta.onet.pl if you are sending mails destined for poczta.onet.pl domain). Unfortunately QHostInfo doesn't provide means for querying for MX records so this needs to be done manually.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Feb 2010
    Posts
    68
    Thanks
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Sending mail - problem with authentication

    toutarrive, wysota - I'm not sure if I got you well but let me explain what do I need it for. I've got pretty small application, which I want to have one additional feature - it should send mails to my mail account, containing information about bugs and opinions from users. They click "send mail" in menu, they write a message content, they specify their e-mail (so I can answer them) and they click "Send". I only want this mail to be delivered to my e-mail account - nothing else. So asking user for login and password is not a good solution here. Now, with such a knowledge, could you say what would be the best thing to do here?

  6. #6
    Join Date
    Mar 2008
    Location
    France
    Posts
    149
    Thanks
    2
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Sending mail - problem with authentication

    See answers #9 and #16.

  7. #7
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Sending mail - problem with authentication

    Quote Originally Posted by kremuwa View Post
    toutarrive, wysota - I'm not sure if I got you well but let me explain what do I need it for. I've got pretty small application, which I want to have one additional feature - it should send mails to my mail account, containing information about bugs and opinions from users. They click "send mail" in menu, they write a message content, they specify their e-mail (so I can answer them) and they click "Send". I only want this mail to be delivered to my e-mail account - nothing else. So asking user for login and password is not a good solution here. Now, with such a knowledge, could you say what would be the best thing to do here?
    The best thing to do would be to fire up the users email client, let them write the message content there, and then click send. No need to request there email address, as the email client will have that already. It'll also go through the appropriate mail server so you don't need to worry about that.

    Why make it more complicated than it needs to be?

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Sending mail - problem with authentication

    Quote Originally Posted by kremuwa View Post
    toutarrive, wysota - I'm not sure if I got you well but let me explain what do I need it for. I've got pretty small application, which I want to have one additional feature - it should send mails to my mail account, containing information about bugs and opinions from users. They click "send mail" in menu, they write a message content, they specify their e-mail (so I can answer them) and they click "Send". I only want this mail to be delivered to my e-mail account - nothing else. So asking user for login and password is not a good solution here. Now, with such a knowledge, could you say what would be the best thing to do here?
    If you are going to send mail to only one specific address (yours) then you can hardcode your application to connect directly to the server handling mail for your account and transmit the message directly to it withouth authenticating. Just be aware that should the mx record for the domain be changed, your application will not be able to transmit emails anymore.

    A much cleaner approach would be to have a php script somewhere in the web that would receive feedback from your application instead of using smtp protocol and emails for this. Getting free hosting with php capabilities shouldn't pose any problem.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Mar 2008
    Location
    France
    Posts
    149
    Thanks
    2
    Thanked 21 Times in 21 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Sending mail - problem with authentication

    currently I'm connecting to smtp server (which belongs to poczta.onet.pl - popular mail service in poland) using my login and password which are specified in the code. Are you saying that "bad people" will fetch this data? What can they do then?
    Harcoding your login and password make yourself recognize by the server (so validate the connection). And then, people using your app will be seen by the server as if you were the one sending a mail.

    Instead your app should asked for a valid login and password on the relevant SMTP server. So, never harcode one in your app.

Similar Threads

  1. Sending Mail through QProcess
    By KaptainKarl in forum Qt Programming
    Replies: 6
    Last Post: 13th August 2008, 21:51
  2. Sending Mail
    By systemz89 in forum Qt Programming
    Replies: 11
    Last Post: 15th June 2008, 16:16
  3. Sending Mail with attachment files
    By joy in forum Qt Programming
    Replies: 2
    Last Post: 14th March 2008, 08:51
  4. help with e-mail sending code
    By locus in forum Qt Programming
    Replies: 4
    Last Post: 4th July 2007, 18:07
  5. Sending mail using Qt
    By munna in forum Qt Programming
    Replies: 3
    Last Post: 18th December 2006, 11:17

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
  •  
Qt is a trademark of The Qt Company.