Click here to Skip to main content
15,888,256 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
i am sending email by below code but email are stuck in queue folder in server. i ve check using message box from address is showing correct email address. and also i am not getting any error also.

And i also see this link

http://social.technet.microsoft.com/Forums/sharepoint/en-US/924280ad-e7dc-4edc-9a88-5995a1675905/eml-files-sitting-in-queue-folder-on-sharepoint-2010-server?forum=sharepointadminprevious[^]

by placing eml files manually in drop folder and start and stop the smtp services but i m getting the same issue

by code is
string smtpServer =SPAdministrationWebApplication.Local.OutboundMailServiceInstance.Server.Address;
string smtpFrom = SPAdministrationWebApplication.Local.OutboundMailSenderAddress;
//Create the mail message and supply it with from and to info
MessageBox.Show("smtpfrom:"+smtpFrom.ToString());
MailMessage mailMessage = new MailMessage(smtpFrom, emailid);

//Set the subject and body of the message
mailMessage.Subject = subject;
mailMessage.Body = body;

//Download the content of the file with a WebClient
WebClient webClient = new WebClient();

//Supply the WebClient with the network credentials of our user
webClient.Credentials = CredentialCache.DefaultNetworkCredentials;
//Download the byte array of the file
byte[] data = webClient.DownloadData(attachementnomenutox);
//Dump the byte array in a memory stream because
//we can write it to our attachment
MemoryStream memoryStreamOfFile = new MemoryStream(data);

//Add the attachment
mailMessage.Attachments.Add(new System.Net.Mail.Attachment(memoryStreamOfFile, nomenutoxfilename));

//Create the SMTP client object and send the message
SmtpClient smtpClient = new SmtpClient(smtpServer);
smtpClient.Send(mailMessage);


Anyone see this issue

Thanks Manohar
Posted
Updated 4-Dec-13 17:54pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900