PageSourceSearch

https://app.selfhostedemailserver.com/build/assets/OutboundRelay-Bnp-pfC0.js

js selfhostedemailserver.com collected 2026-10-03 21:06:54 UTC 18,099 bytes, 1 lines download raw bytes

1import{r as l,g as Se,j as w,Y as je,B as we,b as Fe}from"./app-B3kQcTUR.js";import{A as ke}from"./AuthenticatedLayout-DyRgIbn8.js";import Oe from"./Navbar-BTYL8_NQ.js";import{H as Ce}from"./HelpCrunch-C6_xeZ-c.js";import{G}from"./Grid-d1K2aTE5.js";import{C as ee}from"./Card-xiHu1dtR.js";import{T as te}from"./Title-mcykBrZC.js";import{T as re}from"./Text-D2jHSsfj.js";import{T as se}from"./TextInput-CG1UkSjP.js";import{P as De}from"./PasswordInput-CIjfZpNc.js";import"./ApplicationLogo-DOpzIn9L.js";import"./Footer-CbfFAO21.js";import"./Icons-Bf6fm-c0.js";import"./Flex-8UDlrZjb.js";import"./use-resolved-styles-api-BFgbj_j6.js";import"./use-uncontrolled-DsfLAK2I.js";import"./logger-BkYoI_05.js";import"./NavLink-CJcn4DaL.js";import"./InputBase-BL5wsusS.js";import"./ActionIcon-C9BYakKc.js";function Te(t){if(!/^[0-9a-zA-Z-]+$/.test(t))throw new Error(`[@mantine/use-form] Form name "${t}" is invalid, it should contain only letters, numbers and dashes`)}const $e=typeof window<"u"?l.useLayoutEffect:l.useEffect;function F(t,e){$e(()=>{if(t)return window.addEventListener(t,e),()=>window.removeEventListener(t,e)},[t])}function Ae(t,e){t&&Te(t),F(`mantine-form:${t}:set-field-value`,r=>e.setFieldValue(r.detail.path,r.detail.value)),F(`mantine-form:${t}:set-values`,r=>e.setValues(r.detail)),F(`mantine-form:${t}:set-initial-values`,r=>e.setInitialValues(r.detail)),F(`mantine-form:${t}:set-errors`,r=>e.setErrors(r.detail)),F(`mantine-form:${t}:set-field-error`,r=>e.setFieldError(r.detail.path,r.detail.error)),F(`mantine-form:${t}:clear-field-error`,r=>e.clearFieldError(r.detail)),F(`mantine-form:${t}:clear-errors`,e.clearErrors),F(`mantine-form:${t}:reset`,e.reset),F(`mantine-form:${t}:validate`,e.validate),F(`mantine-form:${t}:validate-field`,r=>e.validateField(r.detail)),F(`mantine-form:${t}:reorder-list-item`,r=>e.reorderListItem(r.detail.path,r.detail.payload)),F(`mantine-form:${t}:remove-list-item`,r=>e.removeListItem(r.detail.path,r.detail.index)),F(`mantine-form:${t}:insert-list-item`,r=>e.insertListItem(r.detail.path,r.detail.item,r.detail.index)),F(`mantine-form:${t}:set-dirty`,r=>e.setDirty(r.detail)),F(`mantine-form:${t}:set-touched`,r=>e.setTouched(r.detail)),F(`mantine-form:${t}:reset-dirty`,r=>e.resetDirty(r.detail)),F(`mantine-form:${t}:reset-touched`,e.resetTouched)}function Ie(t){return e=>{if(!e)t(e);else if(typeof e=="function")t(e);else if(typeof e=="object"&&"nativeEvent"in e){const{currentTarget:r}=e;r instanceof HTMLInputElement?r.type==="checkbox"?t(r.checked):t(r.value):(r instanceof HTMLTextAreaElement||r instanceof HTMLSelectElement)&&t(r.value)}else t(e)}}function W(t){return t===null||typeof t!="object"?{}:Object.keys(t).reduce((e,r)=>{const n=t[r];return n!=null&&n!==!1&&(e[r]=n),e},{})}function Pe(t){const[e,r]=l.useState(W(t)),n=l.useRef(e),s=l.useCallback(u=>{r(f=>{const p=W(typeof u=="function"?u(f):u);return n.current=p,p})},[]),o=l.useCallback(()=>s({}),[]),i=l.useCallback(u=>{n.current[u]!==void 0&&s(f=>{const p={...f};return delete p[u],p})},[e]),c=l.useCallback((u,f)=>{f==null||f===!1?i(u):n.current[u]!==f&&s(p=>({...p,[u]:f}))},[e]);return{errorsState:e,setErrors:s,clearErrors:o,setFieldError:c,clearFieldError:i}}function X(t,e){if(e===null||typeof e!="object")return{};const r={...e};return Object.keys(e).forEach(n=>{n.includes(`${String(t)}.`)&&delete r[n]}),r}function ne(t,e){const r=t.substring(e.length+1).split(".")[0];return parseInt(r,10)}function oe(t,e,r,n){if(e===void 0)return r;const s=`${String(t)}`;let o=r;n===-1&&(o=X(`${s}.${e}`,o));const i={...o},c=new Set;return Object.entries(o).filter(([u])=>{if(!u.startsWith(`${s}.`))return!1;const f=ne(u,s);return Number.isNaN(f)?!1:f>=e}).forEach(([u,f])=>{const p=ne(u,s),g=u.replace(`${s}.${p}`,`${s}.${p+n}`);i[g]=f,c.add(g),c.has(u)||delete i[u]}),i}function Re(t,{from:e,to:r},n){const s=`${t}.${e}`,o=`${t}.${r}`,i={...n},c=new Set;return Object.keys(n).forEach(u=>{if(c.has(u))return;let f,p;if(u.startsWith(s)?(f=u,p=u.replace(s,o)):u.startsWith(o)&&(f=u.replace(o,s),p=u),f&&p){const g=i[f],h=i[p];h===void 0?delete i[f]:i[f]=h,g===void 0?delete i[p]:i[p]=g,c.add(f),c.add(p)}}),i}function ie(t,e,r){typeof r.value=="object"&&(r.value=_(r.value)),!r.enumerable||r.get||r.set||!r.configurable||!r.writable||e==="__proto__"?Object.defineProperty(t,e,r):t[e]=r.value}function _(t){if(typeof t!="object")return t;var e=0,r,n,s,o=Object.prototype.toString.call(t);if(o==="[object Object]"?s=Object.create(t.__proto__||null):o==="[object Array]"?s=Array(t.length):o==="[object Set]"?(s=new Set,t.forEach(function(i){s.add(_(i))})):o==="[object Map]"?(s=new Map,t.forEach(function(i,c){s.set(_(c),_(i))})):o==="[object Date]"?s=new Date(+t):o==="[object RegExp]"?s=new RegExp(t.source,t.flags):o==="[object DataView]"?s=new t.constructor(_(t.buffer)):o==="[object ArrayBuffer]"?s=t.slice(0):o.slice(-6)==="Array
1]"&&(s=new t.constructor(t)),s){for(n=Object.getOwnPropertySymbols(t);e<n.length;e++)ie(s,n[e],Object.getOwnPropertyDescriptor(t,n[e]));for(e=0,n=Object.getOwnPropertyNames(t);e<n.length;e++)Object.hasOwnProperty.call(s,r=n[e])&&s[r]===t[r]||ie(s,r,Object.getOwnPropertyDescriptor(t,r))}return s||t}function ae(t){return typeof t!="string"?[]:t.split(".")}function k(t,e){const r=ae(t);if(r.length===0||typeof e!="object"||e===null)return;let n=e[r[0]];for(let s=1;s<r.length&&n!=null;s+=1)n=n[r[s]];return n}function N(t,e,r){const n=ae(t);if(n.length===0)return r;const s=_(r);if(n.length===1)return s[n[0]]=e,s;let o=s[n[0]];for(let i=1;i<n.length-1;i+=1){if(o===void 0)return s;o=o[n[i]]}return o[n[n.length-1]]=e,s}function Le(t,{from:e,to:r},n){const s=k(t,n);if(!Array.isArray(s))return n;const o=[...s],i=s[e];return o.splice(e,1),o.splice(r,0,i),N(t,o,n)}function _e(t,e,r,n){const s=k(t,n);if(!Array.isArray(s))return n;const o=[...s];return o.splice(typeof r=="number"?r:o.length,0,e),N(t,o,n)}function ve(t,e,r){const n=k(t,r);return Array.isArray(n)?N(t,n.filter((s,o)=>o!==e),r):r}function xe(t,e,r,n){const s=k(t,n);if(!Array.isArray(s)||s.length<=r)return n;const o=[...s];return o[r]=e,N(t,o,n)}function ze({$values:t,$errors:e,$status:r}){const n=l.useCallback((c,u)=>{r.clearFieldDirty(c),e.setErrors(f=>Re(c,u,f)),t.setValues({values:Le(c,u,t.refValues.current),updateState:!0})},[]),s=l.useCallback((c,u)=>{r.clearFieldDirty(c),e.setErrors(f=>oe(c,u,f,-1)),t.setValues({values:ve(c,u,t.refValues.current),updateState:!0})},[]),o=l.useCallback((c,u,f)=>{r.clearFieldDirty(c),e.setErrors(p=>oe(c,f,p,1)),t.setValues({values:_e(c,u,f,t.refValues.current),updateState:!0})},[]),i=l.useCallback((c,u,f)=>{r.clearFieldDirty(c),t.setValues({values:xe(c,f,u,t.refValues.current),updateState:!0})},[]);return{reorderListItem:n,removeListItem:s,insertListItem:o,replaceListItem:i}}var Ne=function t(e,r){if(e===r)return!0;if(e&&r&&typeof e=="object"&&typeof r=="object"){if(e.constructor!==r.constructor)return!1;var n,s,o;if(Array.isArray(e)){if(n=e.length,n!=r.length)return!1;for(s=n;s--!==0;)if(!t(e[s],r[s]))return!1;return!0}if(e.constructor===RegExp)return e.source===r.source&&e.flags===r.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===r.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===r.toString();if(o=Object.keys(e),n=o.length,n!==Object.keys(r).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(r,o[s]))return!1;for(s=n;s--!==0;){var i=o[s];if(!t(e[i],r[i]))return!1}return!0}return e!==e&&r!==r};const q=Se(Ne);function z(t,e){const r=Object.keys(t);if(typeof e=="string"){const n=r.filter(s=>s.startsWith(`${e}.`));return t[e]||n.some(s=>t[s])||!1}return r.some(n=>t[n])}function Be({initialDirty:t,initialTouched:e,mode:r,$values:n}){const[s,o]=l.useState(e),[i,c]=l.useState(t),u=l.useRef(e),f=l.useRef(t),p=l.useCallback(b=>{const V=typeof b=="function"?b(u.current):b;u.current=V,r==="controlled"&&o(V)},[]),g=l.useCallback((b,V=!1)=>{const S=typeof b=="function"?b(f.current):b;f.current=S,(r==="controlled"||V)&&c(S)},[]),h=l.useCallback(()=>p({}),[]),I=l.useCallback(b=>{const V=b?{...n.refValues.current,...b}:n.refValues.current;n.setValuesSnapshot(V),g({})},[]),v=l.useCallback((b,V)=>{p(S=>z(S,b)===V?S:{...S,[b]:V})},[]),d=l.useCallback((b,V,S)=>{g(D=>z(D,b)===V?D:{...D,[b]:V},S)},[]),m=l.useCallback((b,V)=>{const S=z(f.current,b),D=!q(k(b,n.getValuesSnapshot()),V),L=X(b,f.current);L[b]=D,g(L,S!==D)},[]),E=l.useCallback(b=>z(u.current,b),[]),T=l.useCallback(b=>g(V=>{if(typeof b!="string")return V;const S=X(b,V);return delete S[b],q(S,V)?V:S}),[]),O=l.useCallback(b=>{if(b){const S=k(b,f.current);if(typeof S=="boolean")return S;const D=k(b,n.refValues.current),L=k(b,n.valuesSnapshot.current);return!q(D,L)}return Object.keys(f.current).length>0?z(f.current):!q(n.refValues.current,n.valuesSnapshot.current)},[]),P=l.useCallback(()=>f.current,[]),C=l.useCallback(()=>u.current,[]);return{touchedState:s,dirtyState:i,touchedRef:u,dirtyRef:f,setTouched:p,setDirty:g,resetDirty:I,resetTouched:h,isTouched:E,setFieldTouched:v,setFieldDirty:d,setTouchedState:o,setDirtyState:c,clearFieldDirty:T,isDirty:O,getDirty:P,getTouched:C,setCalculatedFieldDirty:m}}function Me({initialValues:t,onValuesChange:e,mode:r}){const n=l.useRef(!1),[s,o]=l.useState(t||{}),i=l.useRef(s),c=l.useRef(s),u=l.useCallback(({values:d,subscribers:m,updateState:E=!0,mergeWithPreviousValues:T=!0})=>{const O=i.current,P=d instanceof Function?d(i.current):d,C=T?{...O,...P}:P;i.current=C,E&&o(C),e==null||e(C,O),m==null||m.filter(Boolean).forEac
1h(b=>b({updatedValues:C,previousValues:O}))},[e]),f=l.useCallback(d=>{var T;const m=k(d.path,i.current),E=d.value instanceof Function?d.value(m):d.value;if(m!==E){const O=i.current,P=N(d.path,E,i.current);u({values:P,updateState:d.updateState}),(T=d.subscribers)==null||T.filter(Boolean).forEach(C=>C({path:d.path,updatedValues:P,previousValues:O}))}},[u]),p=l.useCallback(d=>{c.current=d},[]),g=l.useCallback((d,m)=>{n.current||(n.current=!0,u({values:d,updateState:r==="controlled"}),p(d),m())},[u]),h=l.useCallback(()=>{u({values:c.current,updateState:!0,mergeWithPreviousValues:!1})},[u]),I=l.useCallback(()=>i.current,[]),v=l.useCallback(()=>c.current,[]);return{initialized:n,stateValues:s,refValues:i,valuesSnapshot:c,setValues:u,setFieldValue:f,resetValues:h,setValuesSnapshot:p,initialize:g,getValues:I,getValuesSnapshot:v}}function qe({$status:t}){const e=l.useRef({}),r=l.useCallback((s,o)=>{l.useEffect(()=>(e.current[s]=e.current[s]||[],e.current[s].push(o),()=>{e.current[s]=e.current[s].filter(i=>i!==o)}),[o])},[]),n=l.useCallback(s=>e.current[s]?e.current[s].map(o=>i=>o({previousValue:k(s,i.previousValues),value:k(s,i.updatedValues),touched:t.isTouched(s),dirty:t.isDirty(s)})):[],[]);return{subscribers:e,watch:r,getFieldSubscribers:n}}function ue(t,e){return t?`${t}-${e.toString()}`:e.toString()}const H=Symbol("root-rule");function le(t){const e=W(t);return{hasErrors:Object.keys(e).length>0,errors:e}}function Z(t,e,r="",n={}){return typeof t!="object"||t===null?n:Object.keys(t).reduce((s,o)=>{const i=t[o],c=`${r===""?"":`${r}.`}${o}`,u=k(c,e);let f=!1;return typeof i=="function"&&(s[c]=i(u,e,c)),typeof i=="object"&&Array.isArray(u)&&(f=!0,u.forEach((p,g)=>Z(i,e,`${c}.${g}`,s)),H in i&&(s[c]=i[H](u,e,c))),typeof i=="object"&&typeof u=="object"&&u!==null&&(f||Z(i,e,c,s),H in i&&(s[c]=i[H](u,e,c))),s},n)}function Y(t,e){return le(typeof t=="function"?t(e):Z(t,e))}function K(t,e,r){if(typeof t!="string")return{hasError:!1,error:null};const n=Y(e,r),s=Object.keys(n.errors).find(o=>t.split(".").every((i,c)=>i===o.split(".")[c]));return{hasError:!!s,error:s?n.errors[s]:null}}const He="__MANTINE_FORM_INDEX__";function ce(t,e){return e?typeof e=="boolean"?e:Array.isArray(e)?e.includes(t.replace(/[.][0-9]+/g,`.${He}`)):!1:!1}function Ke({name:t,mode:e="controlled",initialValues:r,initialErrors:n={},initialDirty:s={},initialTouched:o={},clearInputErrorOnChange:i=!0,validateInputOnChange:c=!1,validateInputOnBlur:u=!1,onValuesChange:f,transformValues:p=d=>d,enhanceGetInputProps:g,validate:h,onSubmitPreventDefault:I="always",touchTrigger:v="change"}={}){const d=Pe(n),m=Me({initialValues:r,onValuesChange:f,mode:e}),E=Be({initialDirty:s,initialTouched:o,$values:m,mode:e}),T=ze({$values:m,$errors:d,$status:E}),O=qe({$status:E}),[P,C]=l.useState(0),[b,V]=l.useState({}),[S,D]=l.useState(!1),L=l.useCallback(()=>{m.resetValues(),d.clearErrors(),E.resetDirty(),E.resetTouched(),e==="uncontrolled"&&C(a=>a+1)},[]),B=l.useCallback(a=>{i&&d.clearErrors(),e==="uncontrolled"&&C(y=>y+1),Object.keys(O.subscribers.current).forEach(y=>{const j=k(y,m.refValues.current),$=k(y,a);j!==$&&O.getFieldSubscribers(y).forEach(R=>R({previousValues:a,updatedValues:m.refValues.current}))})},[i]),fe=l.useCallback(a=>{const y=m.refValues.current;m.initialize(a,()=>e==="uncontrolled"&&C(j=>j+1)),B(y)},[B]),J=l.useCallback((a,y,j)=>{const $=ce(a,c),R=y instanceof Function?y(k(a,m.refValues.current)):y;E.setCalculatedFieldDirty(a,R),v==="change"&&E.setFieldTouched(a,!0),!$&&i&&d.clearFieldError(a),m.setFieldValue({path:a,value:y,updateState:e==="controlled",subscribers:[...O.getFieldSubscribers(a),$?x=>{const A=K(a,h,x.updatedValues);A.hasError?d.setFieldError(a,A.error):d.clearFieldError(a)}:null,(j==null?void 0:j.forceUpdate)!==!1&&e!=="controlled"?()=>V(x=>({...x,[a]:(x[a]||0)+1})):null]})},[f,h]),de=l.useCallback(a=>{const y=m.refValues.current;m.setValues({values:a,updateState:e==="controlled"}),B(y)},[f,B]),Q=l.useCallback(()=>{const a=Y(h,m.refValues.current);return d.setErrors(a.errors),a},[h]),me=l.useCallback(a=>{const y=K(a,h,m.refValues.current);return y.hasError?d.setFieldError(a,y.error):d.clearFieldError(a),y}
1,[h]),be=(a,{type:y="input",withError:j=!0,withFocus:$=!0,...R}={})=>{const A={onChange:Ie(M=>J(a,M,{forceUpdate:!1})),"data-path":ue(t,a)};return j&&(A.error=d.errorsState[a]),y==="checkbox"?A[e==="controlled"?"checked":"defaultChecked"]=k(a,m.refValues.current):A[e==="controlled"?"value":"defaultValue"]=k(a,m.refValues.current),$&&(A.onFocus=()=>E.setFieldTouched(a,!0),A.onBlur=()=>{if(ce(a,u)){const M=K(a,h,m.refValues.current);M.hasError?d.setFieldError(a,M.error):d.clearFieldError(a)}}),Object.assign(A,g==null?void 0:g({inputProps:A,field:a,options:{type:y,withError:j,withFocus:$,...R},form:U}))},pe=(a,y)=>j=>{I==="always"&&(j==null||j.preventDefault());const $=Q();if($.hasErrors)I==="validation-failed"&&(j==null||j.preventDefault()),y==null||y($.errors,m.refValues.current,j);else{const R=a==null?void 0:a(p(m.refValues.current),j);R instanceof Promise&&(D(!0),R.finally(()=>D(!1)))}},ye=a=>p(a||m.refValues.current),ge=l.useCallback(a=>{a.preventDefault(),L()},[]),Ee=l.useCallback(a=>a?!K(a,h,m.refValues.current).hasError:!Y(h,m.refValues.current).hasErrors,[h]),Ve=a=>`${P}-${a}-${b[a]||0}`,he=l.useCallback(a=>
1document.querySelector(`[data-path="${ue(t,a)}"]`),[]),U={watch:O.watch,initialized:m.initialized.current,values:m.stateValues,getValues:m.getValues,getInitialValues:m.getValuesSnapshot,setInitialValues:m.setValuesSnapshot,initialize:fe,setValues:de,setFieldValue:J,submitting:S,setSubmitting:D,errors:d.errorsState,setErrors:d.setErrors,setFieldError:d.setFieldError,clearFieldError:d.clearFieldError,clearErrors:d.clearErrors,resetDirty:E.resetDirty,setTouched:E.setTouched,setDirty:E.setDirty,isTouched:E.isTouched,resetTouched:E.resetTouched,isDirty:E.isDirty,getTouched:E.getTouched,getDirty:E.getDirty,reorderListItem:T.reorderListItem,insertListItem:T.insertListItem,removeListItem:T.removeListItem,replaceListItem:T.replaceListItem,reset:L,validate:Q,validateField:me,getInputProps:be,onSubmit:pe,onReset:ge,isValid:Ee,getTransformedValues:ye,key:Ve,getInputNode:he};return Ae(t,U),U}function dt({auth:t,instance:e,emailServer:r}){var p,g;const[n,s]=l.useState(!1),[o,i]=l.useState(null);l.useState(null);const c=Ke({initialValues:{smtpEndpoint:((p=r.outbound_relay)==null?void 0:p.smtp_endpoint)??"",username:((g=r.outbound_relay)==null?void 0:g.smtp_username)??"",password:""}}),u=c.getValues();async function f(h){h.preventDefault(),s(!0);try{const I=await Fe.post(`/server/${e.id}/email-servers/${r.id}/outbound-relay`,{...u})}catch(I){i(I)}finally{s(!1)}}return l.useEffect(()=>{},[]),w.jsxs(ke,{navbarOptions:{width:300,breakpoint:"sm"},navbar:w.jsx(Oe,{}),user:t.user,children:[w.jsx(je,{title:"Outbound Relay"}),w.jsx(G,{gutter:0,children:w.jsxs(G.Col,{span:{lg:8,md:10,sm:12},children:[w.jsx(ee,{radius:"md",shadow:"md",padding:"lg",withBorder:!0,m:"lg",children:w.jsxs(te,{order:3,children:[r.subdomain,".",r.domain]})}),w.jsxs(ee,{radius:"md",shadow:"md",padding:"lg",withBorder:!0,m:"lg",children:[w.jsx(te,{order:3,mb:"lg",children:" Set up outbound relay"}),w.jsxs("form",{onSubmit:f,children:[w.jsxs(re,{mb:"md",children:["Here's a ",w.jsx("a",{href:"https://selfhostedemailserver.com/how-to-configure-outbound-relay-to-use-amazon-ses-simple-email-service/",className:"text-primary",children:"tutorial using Amazon SES for outbound relay"}),". Brevo is another good option for an outbound relay."]}),w.jsx(re,{mb:"md",children:'How to Test: once you configured the SMTP endpoint, Username, Password, you will want to connect to the email server using a native client like Thunderbird. Then send a test email to anywhere. The test email should always be delivered. Additionally, your outbound relay will usually attach a header...for example, Amazon SES will have a "X-SES-Outgoing" header.'}),w.jsx(se,{name:"smtpEndpoint",label:"SMTP Endpoint",error:c.errors.smtpEndpoint,placeholder:"email-smtp.server.com",pattern:"^[a-zA-Z0-9.\\-_%+i]{4,80}$",required:!0,minLength:1,mb:"md",...c.getInputProps("smtpEndpoint")}),w.jsx(se,{name:"username",label:"Username",placeholder:"Username",error:c.errors.username,required:!0,maxLength:30,mb:"md",...c.getInputProps("username")}),w.jsx(De,{name:"password",label:"Password",placeholder:r.outbound_relay?"-------hidden-------":"Password",error:c.errors.password,required:!0,maxLength:99,mb:"md",...c.getInputProps("password")}),w.jsx(we,{type:"submit",disabled:!c.isValid,loading:n,children:"Set outbound relay"})]})]})]})}),w.jsx(Ce,{auth:t})]})}export{dt as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.