Thread: how to send an email using C/C++ with Auth Gmail Account

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    10

    how to send an email using C/C++ with Auth Gmail Account

    Hello,
    I want to simply send email using C or C++.
    I have tried so many examples and sample codes but they didn effect..

    I hv tried to use the google smtp like a smtp replay(i mean pushed through the gmails smtp relay) but gmail is rejecting my IP address and says like this

    Code:
    The IP you're using to send mail is not authorized to send email directly to our servers. Please use the SMTP relay at your service provider instead. Learn more at http://mail.google.com/support/bin/answer.py?answequit               
    .
    Can anyone tell me how to use separate Gmail account authorization and work with this Email thing with C/C++ code..(I mean suppose I have an Gmail Account called [email protected], I hv done this using Java.. Java allow to send emails through that authorized gmail account- by giving username and passwords to the Java code)
    I want to get this work on Windows platform..

    how to do this using C/C++?
    pls help me guyz.
    thanks
    Last edited by harshadura; 08-22-2011 at 09:37 AM.

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    What did we tell you in the other thread?

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Did you read that error message? Even a little bit?

    The first part is important, because, well, that tells us you don't work for Google. You will need to use the SMTP you actually are authenticated to use, which is not Google's.

    The last part is important, because it indicates that you don't know how to use send/recv -- just because you get some data, does not mean you got all the data, as you can tell by that URL getting cut off.

    Have you read a good networking tutorial, like Beej's?

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Can anyone tell me how to use separate Gmail account authorization and work with this Email thing with C/C++ code
    No.

    Tim S.

  5. #5
    Registered User
    Join Date
    Aug 2011
    Posts
    10
    Quote Originally Posted by tabstop View Post
    Did you read that error message? Even a little bit?

    The first part is important, because, well, that tells us you don't work for Google. You will need to use the SMTP you actually are authenticated to use, which is not Google's.

    The last part is important, because it indicates that you don't know how to use send/recv -- just because you get some data, does not mean you got all the data, as you can tell by that URL getting cut off.

    Have you read a good networking tutorial, like Beej's?
    yeah bro.. already I got this method is not working..
    pls can you tell me another way to achieve this email thing? thx lot bro

  6. #6
    Registered User
    Join Date
    Aug 2011
    Posts
    10
    Quote Originally Posted by CommonTater View Post
    What did we tell you in the other thread?
    i am not a spammer Only I need to do is send emails for a One email Account..
    thats it.. pls help me bro

  7. #7
    Registered User
    Join Date
    Aug 2011
    Posts
    10
    Quote Originally Posted by stahta01 View Post
    No.

    Tim S.
    Okay friend, are their any methods u knw which can be used to solve this problem ?

  8. #8
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    If you've done it with Java, then you already know how to do it -- if you need to do it, which if you've done it with Java, you don't.

    The method you need to solve your problem is to not be an idiot, and we can't help you with that.

  9. #9
    Registered User
    Join Date
    May 2011
    Location
    Around 8.3 light-minutes from the Sun
    Posts
    1,949
    Quote Originally Posted by harshadura View Post
    yeah bro.. already I got this method is not working..
    pls can you tell me another way to achieve this email thing? thx lot bro
    Beek's Guide to Network Programming - start reading
    Quote Originally Posted by anduril462 View Post
    Now, please, for the love of all things good and holy, think about what you're doing! Don't just run around willy-nilly, coding like a drunk two-year-old....
    Quote Originally Posted by quzah View Post
    ..... Just don't be surprised when I say you aren't using standard C anymore, and as such,are off in your own little universe that I will completely disregard.
    Warning: Some or all of my posted code may be non-standard and as such should not be used and in no case looked at.

  10. #10
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by harshadura View Post
    yeah bro.. already I got this method is not working..
    pls can you tell me another way to achieve this email thing? thx lot bro
    See... that's the problem with scoop and poop code... you don't actually know how it works and when it doesn't work you end up here begging for help and looking like an idiot.

    A little reading for you ... slash7 with Amy Hoy » Blog Archive » Help Vampires: A Spotter’s Guide

  11. #11
    Registered User
    Join Date
    Aug 2011
    Posts
    10
    Quote Originally Posted by tabstop View Post
    If you've done it with Java, then you already know how to do it -- if you need to do it, which if you've done it with Java, you don't.

    The method you need to solve your problem is to not be an idiot, and we can't help you with that.
    yeah friend i hv done it using Java But I am not able to convert it to C.. im little bit new to C programming.. pls I need some help to get through with this..thx

    here is my Java code on Email stuff at git hub https://github.com/harshadura/JavaMailer

  12. #12
    Registered User
    Join Date
    Aug 2011
    Posts
    10
    Quote Originally Posted by CommonTater View Post
    See... that's the problem with scoop and poop code... you don't actually know how it works and when it doesn't work you end up here begging for help and looking like an idiot.

    A little reading for you ... slash7 with Amy Hoy » Blog Archive » Help Vampires: A Spotter’s Guide
    thx

  13. #13
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Well perhaps if you read the code you just appropriated, you would see this
    dest_addr.sin_port= htons(25); /* PORT defined above */

    Whereas your putative working Java code says this
    props.put("mail.smtp.port", "587");

    Here's more fun and amusement.
    port 587 - Google Search
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  14. #14
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Not to mention that your Java code at least acknowledges the necessity of "authentication", unlike your C code which just connects to the server (although it does give a bogus HELO command, so points there).

    (EDIT: And not to mention Google requires some sort of secure connection as well, and not just a plain network connection, which is going to be even more work.)
    Last edited by tabstop; 08-22-2011 at 10:52 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to send an Email using C/C++
    By harshadura in forum C Programming
    Replies: 13
    Last Post: 08-22-2011, 12:15 AM
  2. Send email via c++
    By davidboja in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2007, 08:51 AM
  3. I lost my gmail account
    By caroundw5h in forum A Brief History of Cprogramming.com
    Replies: 29
    Last Post: 09-10-2004, 02:19 AM
  4. How to Send Email
    By sampatel in forum C Programming
    Replies: 1
    Last Post: 11-23-2002, 02:07 PM