How to send email?
-
I want to send email from local host. I have setuped IIS and SMTP sevver.And configure the Default SMTP Virtual Server w.r.t "Email System Using ASP.NET" and other codeproject articles. Then I debug the cobe and I gave Following information From:127.0.0.1 To :shahdat45ict@yahoo.com Subject:afsd cc:fs Bcc:ad After that, I Clicked on send botton Level show Your email has been sent successfully-Thank You. But actually massage could not send. What can I do?
shahdat
-
I want to send email from local host. I have setuped IIS and SMTP sevver.And configure the Default SMTP Virtual Server w.r.t "Email System Using ASP.NET" and other codeproject articles. Then I debug the cobe and I gave Following information From:127.0.0.1 To :shahdat45ict@yahoo.com Subject:afsd cc:fs Bcc:ad After that, I Clicked on send botton Level show Your email has been sent successfully-Thank You. But actually massage could not send. What can I do?
shahdat
MD. SHAHDAT HOSAIN wrote:
But actually massage could not send. What can I do?
Double check IIS. Is it actually pushing the emails out on the internet, or is it just storing them somewhere. You'll have some folders in C:\inetpub\... somewhere for the SMTP server (if you are using the default configuration). Are your emails in there? You could also show us your code. It might be giving a false positive.
*Developer Day Scotland - Free community conference Delegate Registration Open
-
MD. SHAHDAT HOSAIN wrote:
But actually massage could not send. What can I do?
Double check IIS. Is it actually pushing the emails out on the internet, or is it just storing them somewhere. You'll have some folders in C:\inetpub\... somewhere for the SMTP server (if you are using the default configuration). Are your emails in there? You could also show us your code. It might be giving a false positive.
*Developer Day Scotland - Free community conference Delegate Registration Open
Yes, Two mails were be stored in C:\inetpup\mailroot\queue; and another two mail in C:\inetpup\mailroot\drop; following code was be used private void SendMail() { try { MailMessage Email=new MailMessage(); Email.To=txtTo.Text; Email.From=txtFrom.Text; Email.Cc=txtCC.Text; Email.Bcc=txtBCC.Text; Email.Subject=txtSubject.Text; Email.Body=txtMessage.Text; Email.Priority=MailPriority.High;normal Email.BodyFormat=MailFormat.Text; //Checking whether the attachment is needed or not. if(rbtnAttach.Checked) { Email.Attachments.Add(new MailAttachment(FileBrowse.Value)); } SmtpMail.SmtpServer.Insert(0,"127.0.0.1"); SmtpMail.Send(Email); Reset();//calling the reset method to erase all the data after sending the mail. lblMessage.ForeColor=Color.Navy; blMessage.Text="*Your email has been sent successfully-Thank You"; } //Catching Exception catch(Exception exc) { Reset(); lblMessage.Text="Send error:"+exc.ToString(); lblMessage.ForeColor=Color.Red; } } Note: What's address should be provided in From: text box?Is essential or not? How can I check IIS send is pushing the emails out on the internet? Please keep me
shahdat
-
Yes, Two mails were be stored in C:\inetpup\mailroot\queue; and another two mail in C:\inetpup\mailroot\drop; following code was be used private void SendMail() { try { MailMessage Email=new MailMessage(); Email.To=txtTo.Text; Email.From=txtFrom.Text; Email.Cc=txtCC.Text; Email.Bcc=txtBCC.Text; Email.Subject=txtSubject.Text; Email.Body=txtMessage.Text; Email.Priority=MailPriority.High;normal Email.BodyFormat=MailFormat.Text; //Checking whether the attachment is needed or not. if(rbtnAttach.Checked) { Email.Attachments.Add(new MailAttachment(FileBrowse.Value)); } SmtpMail.SmtpServer.Insert(0,"127.0.0.1"); SmtpMail.Send(Email); Reset();//calling the reset method to erase all the data after sending the mail. lblMessage.ForeColor=Color.Navy; blMessage.Text="*Your email has been sent successfully-Thank You"; } //Catching Exception catch(Exception exc) { Reset(); lblMessage.Text="Send error:"+exc.ToString(); lblMessage.ForeColor=Color.Red; } } Note: What's address should be provided in From: text box?Is essential or not? How can I check IIS send is pushing the emails out on the internet? Please keep me
shahdat
MD. SHAHDAT HOSAIN wrote:
Note: What's address should be provided in From: text box?Is essential or not?
MD. SHAHDAT HOSAIN wrote:
How can I check IIS send is pushing the emails out on the internet?
You can have a look on SMTP response code.
cheers, Abhijit CodeProject MVP
-
Yes, Two mails were be stored in C:\inetpup\mailroot\queue; and another two mail in C:\inetpup\mailroot\drop; following code was be used private void SendMail() { try { MailMessage Email=new MailMessage(); Email.To=txtTo.Text; Email.From=txtFrom.Text; Email.Cc=txtCC.Text; Email.Bcc=txtBCC.Text; Email.Subject=txtSubject.Text; Email.Body=txtMessage.Text; Email.Priority=MailPriority.High;normal Email.BodyFormat=MailFormat.Text; //Checking whether the attachment is needed or not. if(rbtnAttach.Checked) { Email.Attachments.Add(new MailAttachment(FileBrowse.Value)); } SmtpMail.SmtpServer.Insert(0,"127.0.0.1"); SmtpMail.Send(Email); Reset();//calling the reset method to erase all the data after sending the mail. lblMessage.ForeColor=Color.Navy; blMessage.Text="*Your email has been sent successfully-Thank You"; } //Catching Exception catch(Exception exc) { Reset(); lblMessage.Text="Send error:"+exc.ToString(); lblMessage.ForeColor=Color.Red; } } Note: What's address should be provided in From: text box?Is essential or not? How can I check IIS send is pushing the emails out on the internet? Please keep me
shahdat
-
MD. SHAHDAT HOSAIN wrote:
Note: What's address should be provided in From: text box?Is essential or not?
MD. SHAHDAT HOSAIN wrote:
How can I check IIS send is pushing the emails out on the internet?
You can have a look on SMTP response code.
cheers, Abhijit CodeProject MVP
According to Ur suggestion I applied following code. Output show Msg sent successfully. Actually never it is sent to destination. Messages are only push to C:\inetpub\mailroot\queue; 1.I think IIS can not push the emails out on the internet.How can I look on SMTP response code. 2.I want to send emails from localhost. Now I confused how it possible sending a mail from anonymous mail address like "shahdat_mbstu@yahoo.com" through localhost, bcoz there no relation between my localhost and my mail address "shahdat_mbstu@yahoo.com". ; 3. Please help me!; public void CreateCopyMessage(string server) { MailAddress from = new MailAddress("shahdat_mbstu@yahoo.com", "Ben Miller"); MailAddress to = new MailAddress("shahdat45ict@yahoo.com", "Shahdat Kooras");//jane@contoso.com MailMessage message = new MailMessage(from, to); // message.Subject = "Using the SmtpClient class."; message.Subject = "Using the SmtpClient class."; message.Body = @"Using this feature, you can send an e-mail message from an application very easily."; // Add a carbon copy recipient. MailAddress copy = new MailAddress("Notification_List@contoso.com"); message.CC.Add(copy); SmtpClient client = new SmtpClient(server); // Include credentials if the server requires them. client.Credentials= client.Credentials = CredentialCache.DefaultNetworkCredentials; Console.WriteLine("Sending an e-mail message to {0} by using the SMTP host {1}.", to.Address, client.Host); try { client.Send(message); lblMessage.Text = "Message successfully sent"; } catch (Exception ex) { Console.WriteLine("Exception caught in CreateCopyMessage(): {0}", ex.ToString()); } }
shahdat
modified on Tuesday, April 14, 2009 11:09 AM