[ boomLM @ 20.08.2006. 20:48 ] @
Tema postavljena u "E-mail" "Provajderi i servisi" čini ki se da je vezano za obe teme...

Pokušavam već neko vreme da pošaljem mail preko SmtpMail.Send() (C#.NET)

Code:
MailMessage oMsg = new MailMessage();
                // TODO: Replace with sender e-mail address.
                oMsg.From = "[email protected]";
                // TODO: Replace with recipient e-mail address.
                oMsg.To = "[email protected]";
                oMsg.Subject = "Send Using Web Mail";
                // SEND IN HTML FORMAT (comment this line to send plain text).
                oMsg.BodyFormat = MailFormat.Html;
                // HTML Body (remove HTML tags for plain text).
                oMsg.Body = "<HTML><BODY><B>Hello World!</B></BODY></HTML>";
                // ADD AN ATTACHMENT.
                // TODO: Replace with path to attachment.
                //String sFile = @"C:\temp\Hello.txt";
                //MailAttachment oAttch = new MailAttachment(sFile, MailEncoding.Base64);
                //oMsg.Attachments.Add(oAttch);
                // TODO: Replace with the name of your remote SMTP server.
                SmtpMail.SmtpServer = "server...";//stavim pod komentar da bi slao default ali NEĆE ??????
                
                SmtpMail.Send(oMsg);


POMOĆ LJUDI !!!
Još mi to fali da završim seminarski,a za 7 dana ispit...HELP!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Da, kao što rekoh mail šalje samo nakon restartovanja SMTP-a ili kad mu je ćef...nakon 1000-og konektovanja(kako da ga nateram da šalje odmah//nije fora u prioritetu :) )
[ bgd2500 @ 21.08.2006. 11:41 ] @
Probaj da zamenis poslednje dve linije koda sa
Code:

SmtpClient smtpClient = new SmtpClient();
smtpClient.Host = "server...";
smtpClient.Port = 25;
smtpClient.Send(oMsg);
[ bjevta @ 21.08.2006. 13:59 ] @
Ovo parče koda koristim u aplikaciji za automatsko slanje error report-a. Provereno radi.

public static void SendErrorReport( Exception ex ) {
string domain = "mojafirma.com";
string sender = "ja@" + domain;
MailMessage msg = null;
SmtpClient smtpClient = new SmtpClient("smtp." + domain);
NetworkCredential nc = new NetworkCredential(sender, "tajna");
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = nc;
//
StringBuilder sb = new StringBuilder(100);
sb.Append("<br/><br/>Message....: ");
sb.Append(ex.Message);
sb.Append("<br/><br/>Source.....: ");
sb.Append(ex.Source);
sb.Append("<br><br>Stack trace: ");
sb.Append(ex.StackTrace);
//
msg = new MailMessage(sender, sender, "Greška", sb.ToString());
msg.IsBodyHtml = true;
try {
smtpClient.Send(msg);
} catch { }
}

I, kolega, seminarski se rade preko godine, a ne pred ispitni rok. :)
[ boomLM @ 21.08.2006. 14:55 ] @
Znam kolega,znam samo... :(
Hvala vam!!!
Inače SmtpClient Class je podržan u framework 2.0 kako sam pronašao na sajtuMSDN
inače na kompu mi je framework 1.1 tako da(a i SDK je stara) nisam u biblioteci mogao naći ništa pametno...mislim na ovu temu :)
Još uvek nisam završio rad,evo tek sad skidam 2.0...
Pozdrav!
[ boomLM @ 22.08.2006. 02:17 ] @
A evo i rešenja za framework 1.1

Code:

System.Web.Mail.MailMessage message=new System.Web.Mail.MailMessage();

//deo za autentifikaciju kod servera
message.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",1 );
message.Fields.Add
( "http://schemas.microsoft.com/cdo/configuration/sendusername","SmtpHostUserName" );
message.Fields.Add
( "http://schemas.microsoft.com/cdo/configuration/sendpassword","SmtpHostPassword" );
//standardni deo za slanje
message.From="from e-mail";
message.To="to e-mail";
message.Subject="Message Subject";
message.Body="Message Body";
System.Web.Mail.SmtpMail.SmtpServer="SMTP Server Address"; npr.   smtp.gmail.com
System.Web.Mail.SmtpMail.Send(message);


nadam se da će nekome poslužiti da ne gubi vreme i živce
[ Vranac @ 22.08.2006. 10:45 ] @
Malo kasnim sa postom, ali evo, posluzice definitivno

za System.Web.Mail objasnjenje i primeri su na http://systemwebmail.com/

za System.Net.Mail objasnjenje i primeri su na http://www.systemnetmail.com/
[ bjevta @ 22.08.2006. 11:09 ] @
Kad smo kod slanja mail-a, to je podržano framework-om. Šta je sa pop3 protokolom? Imamo li mogućnost da programski rešimo primanje mail-a?

Ako ne, da li neko može da preporuči neku komponentu ili framework za mail? Poželjno open source ili free of charge, naravno.
[ IQooLogic @ 09.09.2006. 22:52 ] @
MailMessage oMsg = new MailMessage();
// TODO: Replace with sender e-mail address.
oMsg.From = "[email protected]";
// TODO: Replace with recipient e-mail address.
oMsg.To = "[email protected]";
oMsg.Subject = "Send Using Web Mail";
// SEND IN HTML FORMAT (comment this line to send plain text).
oMsg.BodyFormat = MailFormat.Html;
// HTML Body (remove HTML tags for plain text).
oMsg.Body = "<HTML><BODY><B>Hello World!</B></BODY></HTML>";
// ADD AN ATTACHMENT.
// TODO: Replace with path to attachment.
//String sFile = @"C:\temp\Hello.txt";
//MailAttachment oAttch = new MailAttachment(sFile, MailEncoding.Base64);
//oMsg.Attachments.Add(oAttch);
// TODO: Replace with the name of your remote SMTP server.
SmtpMail.SmtpServer = "server...";//stavim pod komentar da bi slao default ali NEĆE ??????

SmtpMail.Send(oMsg);

oAttch = null;
oMsg = null;

//TREBALO BI SADA DA RADI - moras da unistis oMsg i oAttch kao sto zatvaras streamreader i writer za pisanje i citanje fajlova !

ILI PROBAJ OVO >

private void sentbtn_Click(object sender, EventArgs e)
{
try
{
Cursor cr = Cursor.Current;
Cursor.Current = Cursors.WaitCursor;

System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage();
mail.From = fromtxt.Text;
if (fromtxt.Text == String.Empty)
{
statuslb.Items.Add("Error : From who is missing.");
}
else
{
statuslb.Items.Add("From : " + fromtxt.Text);
}
mail.To = totxt.Text;
if (totxt.Text == String.Empty)
{
statuslb.Items.Add("Error : To who is missing.");
}
else
{
statuslb.Items.Add("To : " + totxt.Text);
}
mail.Subject = subjecttxt.Text;
if (subjecttxt.Text == String.Empty)
{
statuslb.Items.Add("Error : Subject is missing");
}
else
{
statuslb.Items.Add("Subject: " + subjecttxt.Text);
}

mail.BodyFormat = MailFormat.Text;
statuslb.Items.Add("Mail format : text");
mail.Body = bodyrtxt.Text + "\n\n\n(IQooLogic.NT.018 mail Client)mail: [email protected]\nBuilt by IQooLogic.NT.018 All rights reserved.\nNIS 4Ever!!!";

if (fatt != String.Empty)
{
MailAttachment att = new MailAttachment(fatt, MailEncoding.Base64);
mail.Attachments.Add(att);

SmtpMail.SmtpServer = smtpcombo.Text;
statuslb.Items.Add("SMTP :" + smtpcombo.Text);
SmtpMail.Send(mail);
statuslb.Items.Add("******************SENT******************");
errbtn.BackColor = Color.Lime;
Cursor.Current = cr;

att = null;
}
else
{
statuslb.Items.Add("Attachment : none");
SmtpMail.SmtpServer = smtpcombo.Text;
statuslb.Items.Add("SMTP :" + smtpcombo.Text);
SmtpMail.Send(mail);
statuslb.Items.Add("******************SENT******************");
errbtn.BackColor = Color.Lime;
Cursor.Current = cr;
}
mail = null;
}

catch (Exception err)
{
errbtn.BackColor = System.Drawing.Color.Red;
statuslb.Items.Add("Error : " + err.Message);
statuslb.Items.Add("*********************ERROR*********************");
}
}