claracruz
asked on
SMTP email using c#
Hello experts,
I am trying to send emails via a web application. when i test it on my local machine, it works fine. But when I upload to the live server it doesn't. I am using the follwoing line to send;-
Utils.Mail.MailSender.Send MailMessag e("Localho st", msgWithAttachment);
I got the following code off the internet somewhere;-
Response.Write(bthcu.Messa ge + bthcu.StackTrace);
This outputs the following when the email is not sent;-
Mailbox unavailable. The server response was: 5.7.1 Unable to relay for myemail@yahoo.co.uk at System.Net.Mail.SmtpTransp ort.SendMa il(MailAdd ress sender, MailAddressCollection recipients, String deliveryNotify, SmtpFailedRecipientExcepti on& exception) at System.Net.Mail.SmtpClient .Send(Mail Message message) at Utils.Mail.MailSender.Send MailMessag e(String SMTPServer, MailMessage message) in C:\VS2005Projects\EasyMail Sender\Eas yMailSende r\MailSend er.cs:line 83 at valuation.ImageButton1_Cli ck1(Object sender, ImageClickEventArgs e) in c:\Inetpub\wwwroot\livesit e\valuatio ns\valuati on2.aspx.c s:line 212
I am trying to send emails via a web application. when i test it on my local machine, it works fine. But when I upload to the live server it doesn't. I am using the follwoing line to send;-
Utils.Mail.MailSender.Send
I got the following code off the internet somewhere;-
Response.Write(bthcu.Messa
This outputs the following when the email is not sent;-
Mailbox unavailable. The server response was: 5.7.1 Unable to relay for myemail@yahoo.co.uk at System.Net.Mail.SmtpTransp
http://www.codeproject.com/dotnet/SystemWeb_Mail_SMTP_AUTH.asp
this code demonstrated how to incorporate username and password
this code demonstrated how to incorporate username and password
Hi claracruz
Here is code which I generally use in my asp.net applications
System.Web.Mail.MailMessag e mm=new System.Web.Mail.MailMessag e();
mm.To="tomailid";
mm.From="From";
mm.Body="Hi, test";
System.Web.Mail.SmtpMail.S mtpServer= "Name of the SMTP server name which your live server uses";
System.Web.Mail.SmtpMail.S end(mm);
Harshit Sheth
Here is code which I generally use in my asp.net applications
System.Web.Mail.MailMessag
mm.To="tomailid";
mm.From="From";
mm.Body="Hi, test";
System.Web.Mail.SmtpMail.S
System.Web.Mail.SmtpMail.S
Harshit Sheth
this error:
The server response was: 5.7.1 Unable to relay for myemail@yahoo.co.uk
generally means that the server cannot reack the yahoo.co.uk domain - probably because you need to authenticate yourself as a sender - i dont think it is the code that is the problem
The server response was: 5.7.1 Unable to relay for myemail@yahoo.co.uk
generally means that the server cannot reack the yahoo.co.uk domain - probably because you need to authenticate yourself as a sender - i dont think it is the code that is the problem
this may help you
http://support.microsoft.com/?kbid=895857
http://support.microsoft.com/?kbid=895857
Why not to chk this working example
https://www.experts-exchange.com/questions/21919301/Sending-Mail-in-Net-2005.html
https://www.experts-exchange.com/questions/21919301/Sending-Mail-in-Net-2005.html
ASKER
kaliyugkaarjun ,
My code works on my local computer, I know the code is not the probelmAnd am using c#.
apresto ,
How do i authenticate myself as a sender - i know its not a code problem as it works on my local machine. What I need to know is how to configure my webserver/smtp server to send emails
Many Thanks,
Clara
My code works on my local computer, I know the code is not the probelmAnd am using c#.
apresto ,
How do i authenticate myself as a sender - i know its not a code problem as it works on my local machine. What I need to know is how to configure my webserver/smtp server to send emails
Many Thanks,
Clara
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You might need to use the server's name. Also check if you need to authenticate against the mail server as i think this is whats happening, if so you need to add smtp fields
Apresto