| View previous topic :: View next topic |
| Author |
Message |
giuffsalvo neophyte
Joined: 26 Jul 2009 Posts: 1
|
Posted: Sun Jul 26, 2009 5:49 pm Post subject: SMTP with AUTH support |
|
|
Hello,
is there any plan of implementing support for SMTP AUTH in MLDonkey? I'd like to be able to use the GMail SMTP server to send e-mails...
I know that I should be more collaborative, and try to learn Ocaml, but I don't know anything of functional languages (I'm proficient in Java, Tcl, C, C++)....
Thanks a lot |
|
| Back to top |
|
 |
spiralvoice Sage
Joined: 06 Jan 2003 Posts: 3982 Location: Germany
|
|
| Back to top |
|
 |
Balamutick user

Joined: 19 Oct 2008 Posts: 231 Location: Russia, Saint-Peterburg city
|
Posted: Sat Oct 23, 2010 7:01 am Post subject: My understanding of the implementation of the function auth |
|
|
Hi spiralvoice and other respected people from this forum.
I have no right to demand to write that either. But can I ask and beg .
This function is very, very helpful, but in my opinion, the work for its implementation will require not a lot.
Or am I deluding myself strongly in the simplicity of the implementation of this function, or a lot of people think that there is something complicated, and because such a small thing, not yet written.
Below, I announced the results of my cursory look at the implementation of this.
File is responsible for sending mail is | Code: | | mldonkey\src\utils\net\mailer.ml | , as I understand it.
I have studied features of the protocol SMTP (not all of course ) and I can responsibly say that our common goals, we do not need something grand.
I personally conducted the session via Telnet to the mail server, and passed authentication, sent a letter directly from the telnet interface. The only thing that was difficult was the need to recode the username and password to Base64.
In our case (as it is now working in MLdonkey) without authentication - the process is different in that the exchange with the server, we do not send a command to authentication, such as
AUTH LOGIN
And do not send the username and password, respectively, everything else is done in exactly the same (!).
Below I give a piece of code where in my opinion, lacking just a few lines of code (well, of course, still need a code to pick up parameters from the settings).
-----mldonkey\src\utils\net\mailer.ml ------------->>>
begin from string number 139:
| Code: | let sendmail smtp_server smtp_port new_style mail =
(* a completely synchronous function (BUG) *)
try
let s = simple_connect smtp_server smtp_port in
let ic = in_channel_of_descr s in
let oc = out_channel_of_descr s in
try
if read_response ic <> 220 then bad_response ();
Printf.fprintf oc "HELO %s\r\n" (gethostname ()); flush oc;
if read_response ic <> 250 then bad_response (); |
#####################################
############ HERE should be the code that sends the parameters prescribed in the username and password.
I'll describe how I understand it, note I do not know the syntax and all, "both my hands were left". #####################
##############My example################
| Code: | Printf.fprintf oc "AUTH LOGIN" (); flush oc;
if read_response ic <> 334 then bad_response ();
Printf.fprintf oc "name_on_mail_server_auth_base64" (); flush oc;
if read_response ic <> 334 then bad_response ();
Printf.fprintf oc "password_for_name_on_mail_server_auth_base64" (); flush oc;
if read_response ic <> 235 then bad_response ();
|
#########
Warning: it is not patch, only my personal view as it possible realizable
#############################################
| Code: |
if new_style then
Printf.fprintf oc "MAIL FROM:<s>\r\n" (canon_addr mail.mail_from)
else
Printf.fprintf oc "MAIL FROM:%s\r\n" (canon_addr mail.mail_from);
flush oc;
if read_response ic <> 250 then bad_response ();
if new_style then
Printf.fprintf oc "RCPT TO:<s>\r\n" (canon_addr mail.mail_to)
else
Printf.fprintf oc "RCPT TO:%s\r\n" (canon_addr mail.mail_to);
flush oc;
if read_response ic <> 250 then bad_response ();
Printf.fprintf oc "DATA\r\n"; flush oc;
if read_response ic <> 354 then bad_response ();
let body = make_mail mail new_style in
Printf.fprintf oc "%s\r\n.\r\n" body; flush oc;
if read_response ic <> 250 then bad_response ();
Printf.fprintf oc "QUIT\r\n"; flush oc;
if read_response ic <221>
Printf.fprintf oc "QUIT\r\n"; flush oc;
if read_response ic <> 221 then bad_response ();
close_out oc;
raise e |
P.S. Either I'm naive and there, something must be difficult to pile up, or all those who thought that the opportunity to write this - thought that there is something unreal. _________________ Russian community Mldonkey. Русское сообщество MLdonkey. |
|
| Back to top |
|
 |
ygrek professional

Joined: 20 Mar 2010 Posts: 517
|
Posted: Sun Oct 24, 2010 9:09 am Post subject: |
|
|
Yes, it is that simple. Note that SMTP servers may support different kinds of authentication, not only PLAIN as in your code. Also many servers nowadays are using SSL as a transport layer (for good). But I think we can start supporting simple cases and then evolve as necessary. _________________ Download | Report bugs | git mirror |
|
| Back to top |
|
 |
ygrek professional

Joined: 20 Mar 2010 Posts: 517
|
Posted: Mon Jan 03, 2011 10:15 pm Post subject: |
|
|
Patch implementing SMTP authentication (LOGIN, PLAIN and CRAM-MD5 methods) was committed. _________________ Download | Report bugs | git mirror |
|
| Back to top |
|
 |
Balamutick user

Joined: 19 Oct 2008 Posts: 231 Location: Russia, Saint-Peterburg city
|
Posted: Sat Jan 08, 2011 2:09 am Post subject: |
|
|
| ygrek wrote: | | was committed. | Hm, but how it worked ?
Please, give example bitmap with correct setting _________________ Russian community Mldonkey. Русское сообщество MLdonkey. |
|
| Back to top |
|
 |
ygrek professional

Joined: 20 Mar 2010 Posts: 517
|
Posted: Sun Jan 09, 2011 9:25 am Post subject: |
|
|
| Quote: | Hm, but how it worked ?
Please, give example bitmap with correct setting |
Sorry, I don't understand you. The patch worked ok for me. _________________ Download | Report bugs | git mirror |
|
| Back to top |
|
 |
Balamutick user

Joined: 19 Oct 2008 Posts: 231 Location: Russia, Saint-Peterburg city
|
Posted: Wed Jan 19, 2011 9:08 am Post subject: |
|
|
| ygrek wrote: | | Quote: | Hm, but how it worked ?
Please, give example bitmap with correct setting |
Sorry, I don't understand you. The patch worked ok for me. |
What i do wrong ?
Hello. Thank you for your work in this direction, it is very necessary.
But maybe I did something wrong and I do understand.
I prescribe these settings:
Then press Enter and all is lost, as I understand is stored in the configuration.
But then, nothing happens. I prescribe the correct smtp server, password and email, but I do not priohodit no notification of the completion of injection and not at all.
How to check where the error?
How to configure? (Maybe I'll even write an article on the wiki on this topic)
As for the logs to track exactly where he stumbles work? _________________ Russian community Mldonkey. Русское сообщество MLdonkey. |
|
| Back to top |
|
 |
ygrek professional

Joined: 20 Mar 2010 Posts: 517
|
Posted: Wed Jan 19, 2011 12:14 pm Post subject: |
|
|
Most probably you need my instead of my@mail.example (this depends on server configuration). If it doesn't work - show the strace output when it sends mail, i,e. strace -f -s1024 -ttT -p $(pgrep mlnet) -e '!gettimeofday,poll'. _________________ Download | Report bugs | git mirror |
|
| Back to top |
|
 |
spiralvoice Sage
Joined: 06 Jan 2003 Posts: 3982 Location: Germany
|
Posted: Sat Jan 22, 2011 9:21 am Post subject: |
|
|
| Balamutick wrote: | | Then press Enter and all is lost |
Enter the new value for smtp_login, press Enter.
Enter the new value for smtp_password, press Enter.
When changing option values in HTML interface it is necessary
to press Enter for each change. _________________ Link overview and precompiled cores here: http://mldonkey.sourceforge.net/DownloadLinks |
|
| Back to top |
|
 |
Balamutick user

Joined: 19 Oct 2008 Posts: 231 Location: Russia, Saint-Peterburg city
|
Posted: Mon Jan 24, 2011 4:30 am Post subject: |
|
|
| spiralvoice wrote: | Enter the new value for smtp_login, press Enter.
Enter the new value for smtp_password, press Enter.
When changing option values in HTML interface it is necessary
to press Enter for each change. |
Yes, it helped. Now it works. Will need further clarification in the inscription below.
Help:
| Quote: | | !! press ENTER to send changes to core!! |
need add:
for each value.
ygrek, and how can you do to notice a few people came? I tried a comma does not work.
And will work for almost every individual user, because the properties of each created user can add e-mail address.
Maybe it's the tracker record as request features?
P.s. For the current implementation, a separate and thank you very much _________________ Russian community Mldonkey. Русское сообщество MLdonkey. |
|
| Back to top |
|
 |
ygrek professional

Joined: 20 Mar 2010 Posts: 517
|
Posted: Mon Jan 24, 2011 10:18 am Post subject: |
|
|
| Quote: | Help: Quote:
!! press ENTER to send changes to core!!
need add:
for each value. |
We could make this more visible with some javascript..
| Quote: | ygrek, and how can you do to notice a few people came? I tried a comma does not work.
And will work for almost every individual user, because the properties of each created user can add e-mail address.
Maybe it's the tracker record as request features? |
This should be easy, make a feature request please. _________________ Download | Report bugs | git mirror |
|
| Back to top |
|
 |
Balamutick user

Joined: 19 Oct 2008 Posts: 231 Location: Russia, Saint-Peterburg city
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © phpBB Group
|
|
|
|