SharePoint custom email not shooting, How to fix this?

Hi All,
I trying to send custom email from C# to external user, but mail is not going. But sending to same domain users and find these exceptions in log;
"Type: SmtpFailedRecipientException, Exception Message: Mailbox unavailable. The server response was: 5.7.1 Unable to relay"
"Exception thrown from business logic event listener: System.Net.Mail.SmtpFailedRecipientException: Mailbox unavailable. The server response was: 5.7.1 Unable to relay     at System.Net.Mail.SmtpClient.Send(MailMessage message)    
at ChangeControl3_Nov.eGA_Utility.SendmailnoAttach(String To1, String subject1, String Body1, String frommail1, String FS) in c:\Users\acpbsdt\AppData\Local\Temp\2\Vsta\6c9090f9672f4fba89c20855a223734b\eGA_Utility.cs:line 288     at ChangeControl3_Nov.FormCode.SendBothCTRL256_5_Clicked(Object
sender, ClickedEventArgs e) in c:\Users\acpbsdt\AppData\Local\Temp\2\Vsta\6c9090f9672f4fba89c20855a223734b\FormCode.cs:line 417     at Microsoft.Office.InfoPath.Server.Util.DocumentReliability.InvokeBusinessLogic(Thunk thunk)     at Microsoft.Office.InfoPath.Server.SolutionL...
08e3e29c-259c-60b9-fdb2-5829cbd6a566"
Any idea? Thanks in advance!

Hi,
Please check the links below:
The server response was: 5.7.1 Unable to relay -- Help Please
http://forums.iis.net/t/1165876.aspx?The+server+response+was+5+7+1+Unable+to+relay+Help+Please
Mailbox unavailable. The server response was: 5.7.1 ... we do not relay
http://www.codeproject.com/Questions/94257/Mailbox-unavailable-The-server-response-was
If you want to customize code for send Mail in SharePoint using C# .net code, here is a blog for your reference:
https://technologykhabar.wordpress.com/2013/06/19/custom-code-for-send-mail-in-sharepoint-using-c-net-code/
The code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using Microsoft.SharePoint.Administration;
namespace SendEmail
class Program
static void Main(string[] args)
SPWebApplication webApp = SPWebApplication.Lookup(new Uri("https://serverName/"));
MailMessage mail = new MailMessage();
mail.From = new MailAddress("[email protected]");
mail.To.Add("[email protected]");
mail.Subject = "Subject Test";
mail.Body = "Body Test";
// SmtpClient class sends the email by using the specified SMTP server
SmtpClient smtp = new SmtpClient(webApp.OutboundMailServiceInstance.Server.Address);
smtp.UseDefaultCredentials = true;
smtp.Send(mail);
Best Regards
Dennis Guo
TechNet Community Support

Similar Messages

  • Why all of a sudden am I having difficulty sending Gmail emails? I get a send error. When I run diagnostics there is a SMTP and IMAP account for Gmail and I am not sure how to fix this.

    Why all of a sudden am I having difficulty sending Gmail emails? I get a send error. When I run diagnostics there is a SMTP and IMAP account for Gmail and I am not sure how to fix this.

    Hi jodilynnf,
    When using Connection Doctor to see what is could be causing the issue, look for the red dots to let you know what is wrong. Then all you have to do is correct that information. You can double click on the section that is giving you issue and it will take you there. Most issues could be just password being entered incorrectly. Take a look at the article below to walk you through troubleshooting issues with Mail.
    OS X Mail: Troubleshooting sending and receiving email messages
    http://support.apple.com/en-us/TS3276
     Take it easy,
    -Norm G.

  • I registered my new iPhone 5s to my usual Apple ID, however it isn't showing in my devices when I log in. I tried to register it by adding a new device, but it tells me it's already registered to a different Apple ID. I'm really not sure how to fix this.

    I registered my new iPhone 5s to my usual Apple ID, however it isn't showing in my devices when I log in. I tried to register it by adding a new device, but it tells me it's already registered to a different Apple ID. I'm really not sure how to fix this. I only have the one Apple ID and the phone is brand new, purchased directly from Apple.
    When I check on the phone itself (iCloud and App Store settings) the Apple ID is correct. I'm not sure where else to check.
    Whilst setting up the phone, it prompted me to register, which I did. Then when connecting to my laptop through iTunes it prompted me again so I registered again. I even got a confirmation email to the email address associated with my Apple ID that the registration was successful.
    How can I add my iPhone 5s to the list of devices on the correct Apple ID?
    Thanks in advance for any advice.

    Found the answer to my question after posting (in related discussions)
    https://discussions.apple.com/message/12331666#12331666
    Will call Apple Care as soon as I can.

  • Sync session failed to start on my ipod touch. tried to delete back up history but it only shows my daughters ipod touch and not mine! Im unable to update or purchase new aps, not sure how to fix this problem?

    sync session has failed to start on my ipod touch. Tried to delete the back up but it only shows my daughters ipod touch. Iam unable to update or purchase new aps, not sure how to fix this problem?

    Try:
    https://discussions.apple.com/thread/3415227?start=0&tstart=0
    https://discussions.apple.com/message/16400530#16400530

  • How to use deafult pdf viewer ? when i give windows in my pc pdf file open in firefox deafultly but suddenly its not working how to fix this ?

    please tell me how to use default pdf reader in firefox ? when i give windows in my pc pdf file open in firefox deafultly but suddenly its not working how to fix this ? pdf not open when i give ok with preview in firefox its not open its offer again same message

    In order to change the default pdf reader please see: [[View PDF files in Firefox without downloading them]]
    In order to change the file association: [[Applications panel - Set how Firefox handles different types of files]]

  • It is saying my voicemail is full and it isn't. I do not want to erase my messages, but I do not know how to fix this problem. Can someone help me?

    It is saying my voicemail is full and it isn't. I do not want to erase my messages, but I do not know how to fix this problem. Can someone help me?

    heymare66 wrote:
    The phone usually can hold 24 messages before the voicemail is full, but now I have only 21 and it's saying it's full.
    I think your Voice mailbox goes by time, not # messages, so if one or two of the messages is longer, then it would be "full" faster.
    Go to youmail.com and follow the directions to set up youmail.
    Just curious - why do you need to save 20+ messages?  Once I deal with them, I delete them.... and I rarely have more than one or two \saved messages....

  • When I try and open certain apps, it flickers and doesn't open, I am not sure how to fix this.

    When I try and open open a certain app,it won't open and just flickers and won't do anything, does anyone know how to fix this ?

    Try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until the screen blacks out or you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.

  • I'm not sure how to fix this problem?

    I made my original Apple ID a long time ago, and basically, the e-mail account I had used it with was deleted.  I've made a new Apple ID since.  My i-pod is still connected to the old ID, and I'm not sure how to change it.  I also don't remember the information I had used for the original ID.  My i-pod won't transfer all of my music unless I "authorize the computer" and I can't do that with my new ID becuause it "hasn't been used with the computer" yet.  I have no idea what to do now.  Please help?

    Instead of posting this just hit options to the right off any post and scroll down to Report Abuse, select that and leave a message there.I know it's not abuse but it works when you want to report any posts.
    Message Edited by grayburn on 04-Aug-2009 02:06 PM
    Grayburn @ www.nokiausers.net & www.dailymobile.se....come say Hello!!!
    If you appreciate ANY help from a member,then show it by clicking on the Blue Star button, cheers

  • Error says msvcr80.dll and I do not know how to fix this

    I do not know how to download iTunes for Windows because an error saying that I do not have msvcr80.dll continues to pop up.

    Click here and follow the instructions. You may need to completely remove and reinstall iTunes and all related components, or run the process multiple times; this won't normally affect its library, but that should be backed up anyway.
    (99707)

  • My friend connects his iphone to my itunes for music but now when tries to download an app it asks for my email and password, how to fix this?

    My friend connects his iphone to my computer because i have more music in my itunes library. when he disconnects it and tries to update or download new app it asks for my apple id and not his. Any way to fix this?

    Stop letting him sync his device to your computer.
    He has no legal right to any of the content on your computer.
    Tell this friend to sync his device to his computer, this will remove all content that had been synced from your computer and replace it with content from his computer.
    If he likes the media that you have, you can "gift" him some songs via iTunes or he can purchase it himself.

  • My ipod touch has been disable for 23 000 000 minutes, i do not know how to fix this problem wth out waiting 44 years lol?

    My ipod has been disabled for 23 000 000 and I do not know how to solve the problem. can someone please help.

    Disabled
    Place the iOS device in Recovery Mode and then connect to your computer and restore via iTunes. The iPod will be erased.
    iOS: Forgot passcode or device disabled
    If recovery mode does not work try DFU mode.                        
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings        
    For how to restore:                                                             
    iTunes: Restoring iOS software
    To restore from backup see:
    iOS: Back up and restore your iOS device with iCloud or iTunes       
    If you restore from iCloud backup the apps will be automatically downloaded. If you restore from iTunes backup the apps and music have to be in the iTunes library since synced media like apps and music are not included in the backup of the iOS device that iTunes makes.
    You can redownload most iTunes purchases by:                         
    Downloading past purchases from the App Store, iBookstore, and iTunes Store        
    If problem what happens or does not happen and when in the instructions? When you successfully get the iPod in recovery mode and connect to computer iTunes should say it found an iPod in recovery mode.
    If you previously synced to the computer then you may be able to recover use of the iPod without erasing the iPod by following the instructions here:
    Disabled Recovery-must use syncing computer.

  • My airport express light is flashing orange, not sure how to fix this, can someone assist pls?

    my airport express light is flashing orange
    can someone help to fix this?  please

    Open AirPort Utility - it's in your Mac's Utilities folder. Click the amber dot. It will tell you the reason it's asking for attention.

  • I was working on a project a few days ago and now I'm not getting any audio or visuals out of it. In the project file the screen went grey. Not sure how to fix this. I'm new to iMovie, but the program seems easy to use and my Mac is new. Any help?

    I used to use Movie Maker and it would be able to handle lots of file uploads and big projects. I figure iMovie can do the same since it's newer and it's on my iMac. I was working on a project for a few months, it was working fine up until about a few days ago when the project file just stopped working. Not getting any audio or visuals and the screen went grey. I hope to not lose the project file as I've spent a lot of time on it. The project will still show up in iMovie, but it won't play. Other project files will, but this one won't for some reason. It's my first time using this program and I assumed it would be fine, but now it's causing me big problems. Anyone else run into a similar problem?

    But it is I jsut can sync, back up files, or anything becuase its stuck at this screene and wont do execute when i click either of those button

  • When I turn on my iMac, it shows a black screen and says 'No bootable device - enter boot cd and press any key'.  Not sure how to fix this.

    When I turn on my iMac, it shows a black screen and says 'No bootable device - enter boot cd and press any key'.
    I'm not sure what to do, I did not recieve a cd with my mac to boot it up (I ordered it online).
    Also I can't find my harware serial number (I've tried many times to input what I thought it may be from my receipt).  I saw that I need this number to contact apple support, my 90 day complimentary support is still valid so I wish to contact them.
    I don't know much about apple products as this is my first apple computer so any information is helpful.

    Hold down the Alt/Option-key at startup of your iMac to get the Boot Selection screen.
    From that choose to boot into OSX.
    Once in OSX go to System Preferences then Startup Volume and reset your OSX to be the default.
    The new iMacs have OSX 10.7 Lion preinstalled and don't come with any CD/DVD anymore.
    Instead OSX Lion includes a new feature called "Lion Recovery".
    Have a read here About Lion Recovery
    Stefan

  • Home page weather display will not update how to fix this?

    On my home page, my.Yahoo, I have selected "weather" for one of the displays. In the past this display kept pace with the current day but now it is stuck on a day and will not update to the current day. I have re-booted, terminated FireFox, restarted it, turned the computer off and back on, and the weather still is stuck and will not update.

    A couple more suggestions:
    When you have a problem with one particular site, a good "first thing to try" is clearing your Firefox cache and deleting your saved cookies for the site.
    (1) Bypass Firefox's Cache
    Use Ctrl+Shift+r to reload the page fresh from the server.
    Alternately, you also can clear Firefox's cache completely using:
    "3-bar" menu button (or Tools menu) > Options > Advanced
    On the Network mini-tab > Cached Web Content : "Clear Now"
    If you have a large hard drive, this might take a few minutes.
    (2) Remove the site's cookies (save any pending work first). While viewing a page on the site, try either:
    * right-click and choose View Page Info > Security > "View Cookies"
    * Alt+t (open the classic Tools menu) > Page Info > Security > "View Cookies"
    In the dialog that opens, you can remove the site's cookies individually.
    Then try reloading the page. Does that help?

Maybe you are looking for

  • Error when opening files

    When I open a ditamap and then open one of the files within the ditamap, the file takes several minutes to open (literally). The Frame console shows why -- it's generating dozens of error messages such as the partial list below. The files in the erro

  • Full Screen Video in iWeb

    I created a video on iMovie an then put it on one of my sites on iWeb. I want viewers to be able to view it in fullscreen but that doesn't to be an option. Any suggestions on how to do this?

  • Motion menu not working

    I'm frustrated. In the menu, under Properties/Motion tab, I select the video that I want to set up as my motion menu and it's not working. All I see is a static image of the video clip. The audio works but not the video clip set for motion. Please he

  • Will these software packages work with Tiger?

    I'm wanting to upgrade my old iMac G4 from Jaguar (10.2.8) to Tiger but have some software I want to continue working after the update, I'm pretty sure everything will be okay, but I'm just wanting to make sure. These programs came preinstalled on th

  • Parsing Generic Configuration Object

    Hi, i tried to parse a generic Configuration Object and to get objects and attributes. Unfortunately i got allways null. How is the syntax to get the specify objects? my Configuration object: <Configuration id='#ID#Configuration:SpecialSystemSettings