Has anyone managed to get SendMailAuth to work consistently?
Has anyone managed to get SendMailAuth to work consistently?
I have tried using SendMailAuth with Gmail but was unable to get it to work.
I have tried sending email using AOL with the follwing code using settings provided by AOL, but it only worked twice and now fails each time:
if (GetHostByName("smtp.aol.com", &ip_add, 0, 200) == DNS_OK){
ShowIP(ip_add);
SMTP_PORT = 587;
int x = SendMailAuth(ip_add, (PCSTR)"xxx.xxx@aol.com", (PCSTR)"password",
(PCSTR)"xxx.xxx@aol.com", (PCSTR)emailAddress, (PCSTR)subject, (PCSTR)message);
if (x == 1)
iprintf(": success\r\n");
else
iprintf(": fail\r\n");
}
i have also tried using gmx mail with the setting provided on theior website, and although it always returns as 'success', mail is never sent.
if (GetHostByName("mail.gmx.com", &ip_add, 0, 100) == DNS_OK){
ShowIP(ip_add);
SMTP_PORT = 25;
int x = SendMailAuth(ip_add, (PCSTR)"xxx.xxx@gmx.com", (PCSTR)"password",
(PCSTR)"xxx.xxx@gmx.com", (PCSTR)emailAddress, (PCSTR)subject, (PCSTR)message);
if (x == 1)
iprintf(": success\r\n");
else
iprintf(": fail\r\n");
}
Has anyone any ideas of what I can do to get the email to work, or does anyone know a free email provider that it works for?
Thanks
I have tried sending email using AOL with the follwing code using settings provided by AOL, but it only worked twice and now fails each time:
if (GetHostByName("smtp.aol.com", &ip_add, 0, 200) == DNS_OK){
ShowIP(ip_add);
SMTP_PORT = 587;
int x = SendMailAuth(ip_add, (PCSTR)"xxx.xxx@aol.com", (PCSTR)"password",
(PCSTR)"xxx.xxx@aol.com", (PCSTR)emailAddress, (PCSTR)subject, (PCSTR)message);
if (x == 1)
iprintf(": success\r\n");
else
iprintf(": fail\r\n");
}
i have also tried using gmx mail with the setting provided on theior website, and although it always returns as 'success', mail is never sent.
if (GetHostByName("mail.gmx.com", &ip_add, 0, 100) == DNS_OK){
ShowIP(ip_add);
SMTP_PORT = 25;
int x = SendMailAuth(ip_add, (PCSTR)"xxx.xxx@gmx.com", (PCSTR)"password",
(PCSTR)"xxx.xxx@gmx.com", (PCSTR)emailAddress, (PCSTR)subject, (PCSTR)message);
if (x == 1)
iprintf(": success\r\n");
else
iprintf(": fail\r\n");
}
Has anyone any ideas of what I can do to get the email to work, or does anyone know a free email provider that it works for?
Thanks
- Chris Ruff
- Posts: 222
- Joined: Thu Apr 24, 2008 4:09 pm
- Location: topsail island, nc
- Contact:
Re: Has anyone managed to get SendMailAuth to work consisten
e-mail....not a simple subject.
There are many rules that the servers consider before they will relay your mail out into the void.
They like to see one of the addresses (from or to) to be known to them- like a member of their domain. They pay attention to the subject, data, time, unique string.
I have it working in my code that first it tries AUTH NONE, then AUTH_LOGIN, then AUTH_CRAM_MD5, then AUTH_PLAIN, and if all of that is nakked I will try TLS.
The main thing is to have a dedicated mail server that you pay for every month- in that manner it will always work. For you- your ISP mail server with no auth at all- for your customers- some mail server that they have access to- and for demos and shows- some server like register.com's mail server and etc. that you have a user account and password for.
I have found that these points will get you the best SMTP operation
Chris
There are many rules that the servers consider before they will relay your mail out into the void.
They like to see one of the addresses (from or to) to be known to them- like a member of their domain. They pay attention to the subject, data, time, unique string.
I have it working in my code that first it tries AUTH NONE, then AUTH_LOGIN, then AUTH_CRAM_MD5, then AUTH_PLAIN, and if all of that is nakked I will try TLS.
The main thing is to have a dedicated mail server that you pay for every month- in that manner it will always work. For you- your ISP mail server with no auth at all- for your customers- some mail server that they have access to- and for demos and shows- some server like register.com's mail server and etc. that you have a user account and password for.
I have found that these points will get you the best SMTP operation
Chris
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand
Re: Has anyone managed to get SendMailAuth to work consisten
Also, some servers will only let you send withing a small time window after reading. I guess to verify you can log into your account first. As Chris said, you need to be very specific in your descriptions and tests. For example, "now it fails each time". That's not nearly enough info or verification to comment on. Same from address, same to address, attachment, did you read first, same smpt server, what are all the settings, etc. All necessary information to troubleshoot. As always, did you try the example? It provides debug information in a lot of cases if its available. It helped me a lot.
Re: Has anyone managed to get SendMailAuth to work consisten
The code is automatically generated so it is exactly the same every single time. The code is complete and there is no other code that accesses the server. Is ma not aware of any other settings so they will be the defaults. Like I said, the code is all there is.
I am not sure what other debug information I can add. The only thing that returns from the sendmail function is the code 1 or 0. Is there anything else I can access that will give me more information?
A I said in my post it is the send mail that fails, not the getHost.
Regards
Lachlan
I am not sure what other debug information I can add. The only thing that returns from the sendmail function is the code 1 or 0. Is there anything else I can access that will give me more information?
A I said in my post it is the send mail that fails, not the getHost.
Regards
Lachlan
- Chris Ruff
- Posts: 222
- Joined: Thu Apr 24, 2008 4:09 pm
- Location: topsail island, nc
- Contact:
Re: Has anyone managed to get SendMailAuth to work consisten
When I was making all of the SMTP code work I used to talk to the server just like the code does (telnet <serverHost> : 25) . One of the things I found out by doing this is that servers return different codes than the NB code is looking for. e.g. 253 instead of 250 (not real SMTP return numbers). The SMTP port can also be 587, btw.
The only way you will be able to get your code to work reliably is to become somewhat of an expert in SMTP communications. Learn the codes, talk to the server yourself, etc.
I am assuming that you purchased the SSL package from NetBurner so that you can build ssl_mailto.cpp. One of the things I do when I am working on system library files such as ssl_mailto.cpp (unless something has changed) is that I simply bring that file into my top level working directory and instrument the functions to find out what the server is saying to my code. Once I understand what is up I can either leave the system file in my app (if I changed it) or revert to using the system file down in the library by deleting my local copy. The linker doesn't care either way- it will link in your local copy of the function and ignore the library function or use the library version.
If you do find that some SMTP mail server speaks a slightly different language- it would be good to share that with NetBurner so that they can extend the library function(s) to include the server-speak.
Chris
The only way you will be able to get your code to work reliably is to become somewhat of an expert in SMTP communications. Learn the codes, talk to the server yourself, etc.
I am assuming that you purchased the SSL package from NetBurner so that you can build ssl_mailto.cpp. One of the things I do when I am working on system library files such as ssl_mailto.cpp (unless something has changed) is that I simply bring that file into my top level working directory and instrument the functions to find out what the server is saying to my code. Once I understand what is up I can either leave the system file in my app (if I changed it) or revert to using the system file down in the library by deleting my local copy. The linker doesn't care either way- it will link in your local copy of the function and ignore the library function or use the library version.
If you do find that some SMTP mail server speaks a slightly different language- it would be good to share that with NetBurner so that they can extend the library function(s) to include the server-speak.
Chris
Real Programmers don't comment their code. If it was hard to write, it should be hard to understand
Re: Has anyone managed to get SendMailAuth to work consisten
Thanks for your reply Chris,
I am using the standard code provided and have not purchased the SSL package from Netburner. In fact I did not know it existed.
You suggestions sound good and I will try and implement.
Thanks
Lachlan
I am using the standard code provided and have not purchased the SSL package from Netburner. In fact I did not know it existed.
You suggestions sound good and I will try and implement.
Thanks
Lachlan
Re: Has anyone managed to get SendMailAuth to work consisten
Thanks for nice post share here.
Re: Has anyone managed to get SendMailAuth to work consisten
Have you tried increasing your timeout?
int fd = connect(smtp_server, LOCAL_MAIL_PORT, SMTP_PORT, 20*TICKS_PER_SECOND);
I had SendMailAuth working for a bit then it stopped. I think that increasing the TO from 10 to 20 seconds helped.
Have you had any luck?
I can get both SendMailAuth and SendMailAsServer to work reliably from my office, but it won't connect from the remote location where I'd like it to work. I get an error code -1 (CONNECT_TO_SMTP_SERVER_FAILED) with either function.
Sam
int fd = connect(smtp_server, LOCAL_MAIL_PORT, SMTP_PORT, 20*TICKS_PER_SECOND);
I had SendMailAuth working for a bit then it stopped. I think that increasing the TO from 10 to 20 seconds helped.
Have you had any luck?
I can get both SendMailAuth and SendMailAsServer to work reliably from my office, but it won't connect from the remote location where I'd like it to work. I get an error code -1 (CONNECT_TO_SMTP_SERVER_FAILED) with either function.
Sam
Re: Has anyone managed to get SendMailAuth to work consisten
Maybe a routing problem from the remote site? Is the gateway and dns set properly for that site?
Re: Has anyone managed to get SendMailAuth to work consisten
It seems to be working ok now. I cant recall that I changed anything. I may have change the timeouts but that is all.
Thanks for all the advice.
Regards
Lachlan
Thanks for all the advice.
Regards
Lachlan