Click here to Skip to main content
15,898,723 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi All,

How to Sending one e-mail id from multiple e-mail id.
i am using ASP.NET,C#,SQL2005 and Microsoft Visual
Studio 2008.
Posted
Updated 23-May-12 22:55pm
v3
Comments
Mukund Thakker 24-May-12 4:48am    
Do you want to send email to multiple e-mail id or from multiple Email Ids?

Use the following code:
C#
System.Net.NetworkCredential mailAuthentication = new System.Net.NetworkCredential("sendermail_id", "password");//Sender password
        
        System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("smtpout.secureserver.net");
        
        client.EnableSsl = false;
        client.UseDefaultCredentials = false;
        client.Credentials = CredentialCache.DefaultNetworkCredentials;
        client.DeliveryMethod = SmtpDeliveryMethod.Network;

        client.Credentials = mailAuthentication;
        client.Send(email);
 
Share this answer
 
v2
Comments
AshishChaudha 24-May-12 4:54am    
From where I will send email from multiple email ids?????...

please read the question properly before giving the solution...
Mir Ishaq 24-May-12 4:58am    
where i have written the sender mail_id and password. u can use there object as well.
AshishChaudha 24-May-12 5:08am    
ishaq, there we can use only one sender email ID if i m not wrong...can you pls give us an example..
Mir Ishaq 24-May-12 5:57am    
I m uploading the complete code.
prakash..I think its not possible anyways...even the largest mail servers like gmail, live are not using what you want to use....

whats the reason behind???
 
Share this answer
 
You can use this code. Replace from@abc.com and password from sender emailid and senderpassword respectively.
C#
private void email()
    {
        try
        {        
        StringBuilder emailMessage = new StringBuilder();      
        emailMessage.Append("Hi have a nice day");      
        MailMessage email = new MailMessage();
        email.From = new MailAddress("from@abc.com");
        email.To.Add(new MailAddress(emailAddress));
        email.Subject = "Email Subject";
        email.Body = emailMessage.ToString();
        email.IsBodyHtml = true;

        System.Net.NetworkCredential mailAuthentication = new System.Net.NetworkCredential("from@abc.com", "password");//Sender password
       
        System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("smtpout.secureserver.net");//if u will upload on ftp use(relay-hosting.secureserver.net)
        
        client.EnableSsl = false;
        client.UseDefaultCredentials = false;
        client.Credentials = CredentialCache.DefaultNetworkCredentials;
        client.DeliveryMethod = SmtpDeliveryMethod.Network;

        client.Credentials = mailAuthentication;
        client.Send(email);
        Response.Write("message sent");
        }
        catch (Exception ex)
        {

             Response.Write(ex.Message);
        }
 
Share this answer
 
v2

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