0

I want send Email using Asp.net3.5, c#.net. I am able to send it using smtp.gmail.com with my ID [email protected], but my client given there details to send from there Id. With that I am unable to send. Details looks different like .Ex. xxx.xxx.com not like smtp.gmail.com there is no SMTP word in that host name. Please help me, how to send Email?

3
  • 2
    Can you add your current code? So we can have a look at where it might go wrong. Commented Feb 14, 2011 at 10:16
  • code is working fine if i give my gmail details like Host: Smtp.gmail.com band uid :[email protected] pwd: xxxx.but when i changed to their details only unable to send Commented Feb 14, 2011 at 10:32
  • what error message (exception) do you receive when you try to send the mail with your clients credetials? "With that I am unable to send" doesn't give us enough information to help you. =) Commented Feb 14, 2011 at 10:46

3 Answers 3

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

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" );

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";
System.Web.Mail.SmtpMail.Send(message);

For More info check this

Sign up to request clarification or add additional context in comments.

Comments

0

instead of using smtp.gmail.com use mail.XXX.com, you will be able to sent mail.

4 Comments

but my client provide me deffernt Host name..there is no SMTP or MAIl in that host name which they given to me ..just like xxxx.xxxx.com only how can i..? cann i ask them to provide SMTP address again
@santhosh, a server name doesn't have to have smtp or mail in it for it to be acting as a mail server. It could be called potato.domain.com and still be a mailserver =)
So..like this mail server name how to send email using Asp.net i worked with smtp.domain.com like this process only please help me iam hanged here how to send email like potato.domain.com
moreover you also have to edit for the boolean value, sequre SMTP allows or not. Google allows secure SMTP while others not.
0

There are a lot of sites on the net which will give you explanation and code as to how you can send mails in asp.net 3.5. You just need to google a bit. I have listed some sites which might be helpful to you. Compare your code with the ones given on these sites and check where you have made a mistake. Also if you can post your code here then we would be in a better position to help you out.

http://www.c-sharpcorner.com/UploadFile/dchoksi/SendingMail02132007002923AM/SendingMail.aspx

http://www.dotnetcurry.com/ShowArticle.aspx?ID=65&AspxAutoDetectCookieSupport=1

http://www.eggheadcafe.com/articles/20030720.asp

http://jalpesh.blogspot.com/2009/07/sending-email-through.html

Regards,

Samar

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.