Free Support Forum - aspose.com

Mail Sending is not working

Hi,

We are using Aspose.Network[Version 3.6.0.0] component to send an email. But sometimes it's working and sometimes it's not.

Please see the following code which i have written.

SMTPServerAddress[IP ADDRESS] mentioned in web.config file.

Aspose.Network.License lic = new Aspose.Network.License();
lic.SetLicense(System.Configuration.ConfigurationSettings.AppSettings["AsposeLicPath"]);
Aspose.Network.Mail.MailMessage msg1 = new Aspose.Network.Mail.MailMessage();
msg1.Subject = "ThirupathiHY";
msg1.To = "munigyalathirupathi@hotmail.com";
msg1.TextBody = "Thirupathi_New";
msg1.Sender = "munigyalathirupathi@hotmail.com";
Aspose.Network.Mail.SmtpClient client1 = new Aspose.Network.Mail.SmtpClient(System.Configuration.ConfigurationSettings.AppSettings["SMTPServerAddress"]);
client1.AuthenticationMethod = Aspose.Network.Mail.SmtpAuthentication.None;
client1.Send(msg1);

Why it's behaving like that. If i use simple .net MailMessage class with same SMTP address,it's working fine.

I would appreciate for quick reply. Its urgent issue.

Thanks in Advance

Hi,

Please try the "From" property of the MailMessage class instead of "Sender". If it does not work, please put the code in try block and post the exception here.

Hi,

Thanks for early response. Eventhough we are using From instead of Sender,it's not working. One more thing if we use From instead of Sender, the receiver couldn't see the sender address in the mail list, the sender address coming as blank when mail is coming as i told sometime it's working and not sometime.Alreay TRY CATCH black implemented but we are not getting any exception.

We are using Aspose component just for encoding the subject, otherwise .net MailMessage class is better.

I hope exact solution will be received this time.

Thanks in advance,

Thirupathi

Hi Thirupathi,

Can you please tell us your system's environment in which you are testing this. e.g. Operating system, mail server, .Net framework version etc.

I am using the code below and its sending emails to hotmail and other servers perfectly.

Aspose.Network.Mail.MailMessage msg1 = new Aspose.Network.Mail.MailMessage();
msg1.Subject = "Subject";
msg1.To = saqib.razzaq@aspose.com;
msg1.TextBody = "text body";
msg1.From = saqib.razzaq@aspose.com;
Aspose.Network.Mail.SmtpClient client1 = new SmtpClient("smtpserverAddress", 25, saqib.razzaq@aspose.com", "pwd");
client1.Send(msg1);

I am not using "Sender" here but I can see the address in mail list, both in web interface and outlook. My environment is Windows XP, Visual Studio 2005, .net framework 2.0 and Aspose.Network 3.8

I am only doubtfull in one thing that you have mentioned. "Sometimes its working and sometimes it wont". How frequently are you running the program? Can you send some screenshot where sender address is coming blank.

I would also recommend you to use Aspose.Network 3.8 which has new features and bug fixes as well.