[Mono-aspnet-list] Socket error sending secured mail.
dev.malst at apsystems.it
Fri Jun 4 04:50:44 EDT 2010
I'm sorry but maybe I'm missing something. I used field specification
to set the port so it's not 25
http://schemas.microsoft.com/cdo/configuration/smtpserverport"] = 465;
I looked at System.Web.Mail.SmtpClient source code and it reads those
fields from message to set socket connection so it should work, if it
uses port 25 it should give a timeout error, not an immediately
socket exception I think.
Field specification works in MS.NET even if not using exchange server
(The same code works against google in windows environment).
Maybe is one of the most items of MS.NET that does not match the
aspected behavior but looking at Mono source code it should use those
fields, unless there's some problem with TLS. I tried your code on
188.8.131.52 VM and it waits indefinitely, I've to restart apache. Maybe
it's because I don't use Mono 2.6 but this version it's pretty new,
in FAQ there's no version specified, I thought it could be used also
with older versions, it's a problem for me to update.
At 13.10 03/06/2010, you wrote:
>On 03.06.2010 11:10, APS wrote:
> > Hi,
> > I'm trying so send secured mail with mono using System.Web.Mail in aspnet.
> > I read this
> > and I made the described operations but when I try to send the mail I
> > always immediately obtain
> > System.Web.HttpException: Connection refused --->
>This is expected because you're actually connecting on port 25.
> > System.Web.Mail.MailMessage msg = new System.Web.Mail.MailMessage();
> > msg.From = "test at gmail.com";
> > msg.To = "test at gmail.com";
> > msg.Subject = "test";
> > msg.Body = "test";
> > msg.BodyFormat = System.Web.Mail.MailFormat.Html;
> > msg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"]
> > = "smtp.gmail.com";
>This fields base configuration is of no use unless you're relaying
>the mail through a Microsoft Exchange saver.
>You're supposed to do something like that (code borrowed
>from Abe Gillespie/Mono list):
> static void SendEmail()
> var sender = "sender at gmail.com";
> var email = "receiver at mail.com";
> var from = new MailAddress(sender, "Sender");
> var to = new MailAddress(email);
> var mail = new MailMessage(from, to);
> // Set the content.
> mail.Subject = "Subject";
> mail.Body = "Body";
> // Send the message.
> SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
> smtp.EnableSsl = true;
> smtp.Credentials = new NetworkCredential(sender, "password");
>You'll need Mono 2.6.x (or 2.4 + Mono.Security.dll from 2.6,
>at you own risk) and don't forget to import the
>certs as described here
>Mono-aspnet-list mailing list
>Mono-aspnet-list at lists.ximian.com
>Il messaggio e' stato analizzato alla ricerca di virus o
>contenuti pericolosi da MailScanner, ed e'
>risultato non infetto.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-aspnet-list