CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 4 FirstFirst 1234 LastLast
Results 16 to 30 of 47
  1. #16
    Join Date
    Jun 2004
    Location
    England
    Posts
    90

    Post

    Makes sense to me, I will test it out.

    Thanks for the reply
    The most knowledgeable people are those who know that they know nothing.

  2. #17
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Well...and to provide another reason...this is old code, copied and pasted for a long time...maybe it needs a rewrite...
    Last edited by Andreas Masur; July 1st, 2004 at 12:04 PM.

  3. #18
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Originally posted by Bond
    Maybe because sprintf, like wsprintf (as I found out), has a limit of 1024 characters.
    Really? Did not know that....thanks for pointing that out...

  4. #19
    Join Date
    May 2004
    Location
    Michigan, United States
    Posts
    457
    I was guessing that was the case. Turns out it isn't. wsprintf DOES have a 1024 limit. sprintf does not.

    Here's a little test:
    Code:
    #include <windows.h>
    #include <stdio.h>
    
    int main()
    {
    	// Create a really large buffer...
    	char szBuffer[4096] = {0};
    
    	// Fill 100 elements with consecutive letters (0-99=A, 100-199=B,..., 2500-2599=Z)...
    	for (int i = 0; i < 26; i++)
    		for (int j = 0; j < 100; j++)
    			szBuffer[i * 100 + j] = 65 + i;
    
    	// End the string at the 2600th element...
    	szBuffer[2600] = 0;
    
    	// Display the string...
    	printf("Original String\n%s\n\n", szBuffer);
    	
    	// Now, copy the string using sprintf/wsprintf...
    	char szBuffer2[4096];
    	wsprintf(szBuffer2, "%s", szBuffer);
    
    	// Display the new string...
    	printf("New String:\n%s\n\n", szBuffer2);
    
    	return 0;
    }
    You'll find that the original string is printed in its entirety. The new string, however, ends at the 24th K.

    K = 10th letter...
    10 * 100 elements/letter = 1000...
    Add the 24...
    1024 elements copied into new buffer.

    If you change the wsprintf line to use sprintf instead, it works fine.
    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.

  5. #20
    Join Date
    Jun 2004
    Location
    England
    Posts
    90
    That is possible, but maybe it is to do with memory..
    Not really sure
    The most knowledgeable people are those who know that they know nothing.

  6. #21
    Join Date
    Jun 2004
    Posts
    9
    Andreas,

    I could run that code and i m not getting any errors..still it doesnt send any mail..i mean i gave cmd line arguments like this

    "sendmail mail.infotechsa.com sushp@infotechsa.com sushp@infotechsa.com message.txt"

    this doesnt send mail to abv address...plz tell me some details abt last arguement ..is it a .txt file?if yes,shud i give full path of that file on my computer?or i what else shud i enter there?
    plzzzzzz reply.

  7. #22
    Join Date
    May 2000
    Location
    KY, USA
    Posts
    18,652
    Originally posted by sushb4u
    this doesnt send mail to abv address...plz tell me some details abt last arguement ..is it a .txt file?if yes,shud i give full path of that file on my computer?or i what else shud i enter there?
    plzzzzzz reply.
    Well...it sends the mail correctly, however the body is somehow empty...I need to test this further I guess...sorry about that...

  8. #23
    Join Date
    Sep 2002
    Location
    St.Louis, MO
    Posts
    27
    I know this is late, but try this class: http://www.naughter.com/smtp.html

    Not only is it well written but very solid.

    Tom
    Thanks
    Tom Wright

  9. #24
    Join Date
    Jun 2004
    Posts
    9
    Hi everybody..

    all abv programs need name of smtp server...but i have only email address of receipent...so does anybosy know function or api to get smtp server name from given email address??or else can i use any standerd smtp server for any email id?if yes...plz tell me which smtp server i can use.

    Thanks

  10. #25
    Join Date
    May 2004
    Location
    45,000FT Above Nevada
    Posts
    1,539
    Normally you would send email through your smtp server for your ISP/email account unless you are trying to hide your email address/identity/IP address. Many ISP's are not accepting email directly from a person to their smtp server unless they have a email account on that server. Many ISP are checking origin of email and if it is not from a registered email server(IP address) it won't relay email or accept the mail. With 80% of email today as spam ISP's are cracking down on people using their resources for someone elses gain.

    So just send the email through your ISP's smtp server and all will work just fine.

    HTH
    Jim
    ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII

    "The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.

    "Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.

  11. #26
    Join Date
    Jun 2004
    Posts
    9
    hi...thanz a lot...but i m sorry..i didnt get much..(
    what do u mean by

    "Normally you would send email through your smtp server for your ISP/email account "

    ya i dont want to hide senders email address or identity...but user can enter any email id in from and to fields....so how can i get smtp server for that account's ISP??

  12. #27
    Join Date
    May 2004
    Location
    45,000FT Above Nevada
    Posts
    1,539
    ya i dont want to hide senders email address or identity...but user can enter any email id in from and to fields....so how can i get smtp server for that account's ISP??
    If this is the case then you would have the user enter their smtp server address. As with most ISP's today in order to send email through their smtp server you must have a email account and log on with a user id and password this keeps people from using false return email address and using their smtp servers to relay SPAM.
    Jim
    ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII

    "The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.

    "Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.

  13. #28
    Join Date
    Jun 2004
    Posts
    9
    If this is the case then you would have the user enter their smtp server address.
    user's stmp server address means which address?? i mean suppose i m not asking for from id (it is fixed) and i m asking for only "To" address...and user entered "abc@yahoo.com" and suppose my from id is "me@mycomp.com" then i have to use which smtp server? server for input email address or server for mycomp's address?

    i m sorry if i m creating some confusion...but plz reply

  14. #29
    Join Date
    May 2004
    Location
    45,000FT Above Nevada
    Posts
    1,539
    "To" address...and user entered "abc@yahoo.com" and suppose my from id is "me@mycomp.com" then i have to use which smtp server? server for input email address or server for mycomp's address?
    You would use the smtp server for "me@mycomp.com", you use the smtp server of the senders address.
    Jim
    ATP BE400 CE500 (C550B-SPW) CE560XL MU300 CFI CFII

    "The speed of non working code is irrelevant"... Of course that is just my opinion, I could be wrong.

    "Nothing in the world can take the place of persistence. Talent will not; nothing is more common than unsuccessful men with talent. Genius will not; unrewarded genius is almost a proverb. Education will not; the world is full of educated derelicts. Persistence and determination are omnipotent. The slogan 'press on' has solved and always will solve the problems of the human race."...Calvin Coolidge 30th President of the USA.

  15. #30
    Join Date
    Jun 2004
    Posts
    9
    ok... thanx a lottt my prog is working now.

    can i give any points or like something that??i m new to this forum...thats why i m asking this.

Page 2 of 4 FirstFirst 1234 LastLast

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured