Makes sense to me, I will test it out.
Thanks for the reply
Printable View
Makes sense to me, I will test it out.
Thanks for the reply
Well...and to provide another reason...this is old code, copied and pasted for a long time...maybe it needs a rewrite... :cool:
Really? Did not know that....thanks for pointing that out...Quote:
Originally posted by Bond
Maybe because sprintf, like wsprintf (as I found out), has a limit of 1024 characters.
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:
You'll find that the original string is printed in its entirety. The new string, however, ends at the 24th K.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;
}
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.
That is possible, but maybe it is to do with memory..
Not really sure
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.
Well...it sends the mail correctly, however the body is somehow empty...I need to test this further I guess...sorry about that...Quote:
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.
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
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
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
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??
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.Quote:
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??
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?Quote:
If this is the case then you would have the user enter their smtp server address.
i m sorry if i m creating some confusion...but plz reply:(
You would use the smtp server for "me@mycomp.com", you use the smtp server of the senders address.Quote:
"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?
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.