Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Email Sender not sending to gmail,hotmail etc but will send to the domain from it is sent addresses

Email Sender not sending to gmail,hotmail etc but will send to the domain from it is sent addresses

Scheduled Pinned Locked Moved C#
helpcomsysadmintutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    new2pgrmg
    wrote on last edited by
    #1

    Hi all, I am modifying an application that will send email via smtp.My problem is its not sending emails to gmail,aol etc.Getting an eror"Mailbox unavailable. The server response was: 5.7.1 Unable to relay for [email]" I searched and found its issue with authetication. My questions are: 1)Is it possible to sent mail to gmail,hotmail,aol etc from a application like this. 2)Whats the username and pasword for authntication .I found this code when i searched but confused about how to implement.Any help is welcome. The link is " My code looks like this: public void sendSmtp() { if (!ValidateEmailSender()) return; clsEmailSender emailSender = new clsEmailSender(); MailAddress sendFrom = new MailAddress("devjn@itsoft.com"); MailAddress sendTo = new MailAddress(txtEmailTo.Text); MailMessage myMessage = new MailMessage(sendFrom, sendTo); if(txtEmailCc.Text!="") { MailAddress sendCc = new MailAddress(txtEmailCc.Text); myMessage.CC.Add(sendCc); } if (txtEmailBcc.Text != "") { MailAddress sendBcc = new MailAddress(txtEmailBcc.Text); myMessage.Bcc.Add(sendBcc); } myMessage.Subject = txtEmailSubject.Text; myMessage.Body = txtEmailBody.Text; SmtpClient emailClient = new SmtpClient("mail.tri.com", 28); emailClient.Send(myMessage); }

    M realJSOPR 2 Replies Last reply
    0
    • N new2pgrmg

      Hi all, I am modifying an application that will send email via smtp.My problem is its not sending emails to gmail,aol etc.Getting an eror"Mailbox unavailable. The server response was: 5.7.1 Unable to relay for [email]" I searched and found its issue with authetication. My questions are: 1)Is it possible to sent mail to gmail,hotmail,aol etc from a application like this. 2)Whats the username and pasword for authntication .I found this code when i searched but confused about how to implement.Any help is welcome. The link is " My code looks like this: public void sendSmtp() { if (!ValidateEmailSender()) return; clsEmailSender emailSender = new clsEmailSender(); MailAddress sendFrom = new MailAddress("devjn@itsoft.com"); MailAddress sendTo = new MailAddress(txtEmailTo.Text); MailMessage myMessage = new MailMessage(sendFrom, sendTo); if(txtEmailCc.Text!="") { MailAddress sendCc = new MailAddress(txtEmailCc.Text); myMessage.CC.Add(sendCc); } if (txtEmailBcc.Text != "") { MailAddress sendBcc = new MailAddress(txtEmailBcc.Text); myMessage.Bcc.Add(sendBcc); } myMessage.Subject = txtEmailSubject.Text; myMessage.Body = txtEmailBody.Text; SmtpClient emailClient = new SmtpClient("mail.tri.com", 28); emailClient.Send(myMessage); }

      M Offline
      M Offline
      Mbah Dhaim
      wrote on last edited by
      #2

      see this[^]

      1 Reply Last reply
      0
      • N new2pgrmg

        Hi all, I am modifying an application that will send email via smtp.My problem is its not sending emails to gmail,aol etc.Getting an eror"Mailbox unavailable. The server response was: 5.7.1 Unable to relay for [email]" I searched and found its issue with authetication. My questions are: 1)Is it possible to sent mail to gmail,hotmail,aol etc from a application like this. 2)Whats the username and pasword for authntication .I found this code when i searched but confused about how to implement.Any help is welcome. The link is " My code looks like this: public void sendSmtp() { if (!ValidateEmailSender()) return; clsEmailSender emailSender = new clsEmailSender(); MailAddress sendFrom = new MailAddress("devjn@itsoft.com"); MailAddress sendTo = new MailAddress(txtEmailTo.Text); MailMessage myMessage = new MailMessage(sendFrom, sendTo); if(txtEmailCc.Text!="") { MailAddress sendCc = new MailAddress(txtEmailCc.Text); myMessage.CC.Add(sendCc); } if (txtEmailBcc.Text != "") { MailAddress sendBcc = new MailAddress(txtEmailBcc.Text); myMessage.Bcc.Add(sendBcc); } myMessage.Subject = txtEmailSubject.Text; myMessage.Body = txtEmailBody.Text; SmtpClient emailClient = new SmtpClient("mail.tri.com", 28); emailClient.Send(myMessage); }

        realJSOPR Offline
        realJSOPR Offline
        realJSOP
        wrote on last edited by
        #3

        That's because your SMTP server doesn't allow mail relay. The from address has to be an account on the SMTP server, or it won't send.

        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
        -----
        "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups