Error getting sendmail to properly send emails from AWS EC2 server (domain of server address does not exist)

2,927

Solution 1

 ----- Transcript of session follows -----
... while talking to smtp02.yahoo.com.:
>>> MAIL From:<[email protected]> SIZE=669
<<< 553 #5.1.8 Domain of sender address <[email protected]> does not exist

Explicitly set envelope sender address using sendmail -f command line options

OR

Make your sendmail use "this host email name" ($j) with public MX or A DNS records.
https://askubuntu.com/questions/9540/how-do-i-change-the-computer-name

OR

Make your sendmail masquearde as another host for email purposes
https://www.sendmail.com/sm/open_source/docs/m4/masquerading.html

Solution 2

Large swaths of the EC2 address space are blacklisted by several email providers. If you need to send email from your instance, you'll either need to relay out through a non-EC2 host or else use AWS's SES service to send email.

Personally, I use SES, as it's very easy to integrate with your MTA, and prices are very low (or free) for all but the largest email volumes.

Share:
2,927

Related videos on Youtube

EliKnaffo
Author by

EliKnaffo

Updated on September 18, 2022

Comments

  • EliKnaffo
    EliKnaffo over 1 year

    I have tried everything on the internet and nothing seems to fix my error.

    this is my NgModule :

    import { BrowserModule } from '@angular/platform-browser';
    import { NgModule } from '@angular/core';
    import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
    import { AppComponent } from './app.component';
    import { MDBBootstrapModule } from 'angular-bootstrap-md';
    import { FormsModule } from '@angular/forms';
    import { MainLayoutComponent } from './MainLayout/main-layout/main-layout.component';
    import { AppRoutingModule } from './app-routing.module';
    import { ContainersPageComponent } from './Containers/containers-page/containers-page.component';
    
    import { HttpClientModule } from '@angular/common/http';
    import { MatTableModule } from '@angular/material/table';
    import { MarinServiceService } from './services/marin-service.service';
    import { MatPaginatorModule, MatSortModule, MatInputModule, MatSelectModule, MatFormFieldModule } from '@angular/material';
    
    
    
    @NgModule({
      declarations: [
        AppComponent,
        MainLayoutComponent,
        ContainersPageComponent,
    
      ],
      imports: [
        BrowserModule,
        BrowserAnimationsModule,
        MDBBootstrapModule.forRoot(),
        FormsModule,
        AppRoutingModule,
        HttpClientModule,
        MatTableModule,
        MatPaginatorModule,
        MatSortModule,
        MatInputModule,
        MatSelectModule,
        MatFormFieldModule,
    
      ],
      providers: [MarinServiceService],
      bootstrap: [AppComponent]
    })
    export class AppModule { }
    

    This is the exact Error im getting :

    )
    : 'mat-selection-list' is not a known element:
    1. If 'mat-selection-list' is an Angular component, then verify that it is part of this module.
    2. If 'mat-selection-list' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
    
      <!--Check Box Search-->
      [ERROR ->]<mat-selection-list >
        <mat-list-option >
    

    I have tried re-Importing and it didn't work. I have tried importing everything Mat related.

    I really don't know what seems to be the problem.

    • kmarsh
      kmarsh over 10 years
      Yahoo has stringent anti-spam requirements if you desire to deliver directly to their users. Among them are reverse DNS lookup. If this is the problem, another tactic can be to deliver mail to a recognized server, such as your company or customer's mail server, and have that forward to Yahoo. The intermediate mail server would simply have to accept mail from the EC2 machine, after that it should know what to do.
    • msanford
      msanford almost 5 years
      I think you mean 'mat-list-option' is not an Angular component? Maybe include a stack trace of the error, and the template in which you implemented it?
    • ram12393
      ram12393 almost 5 years
      what's the exact error you are getting actually?
  • Michael - sqlbot
    Michael - sqlbot over 10 years
    Take that last step and make sendmail use the server's actual external DNS hostname, not its internal DNS hostname, as it is using now. EC2 has a fake internal ".internal" TLD for internal host resolution. Changing the hostname from "xxx.us-west-2.compute.internal" to "xxx.us-west-2.compute.amazonaws.com" (the answer you get if you nslookup your EC2 machine's IP address from outside EC2) and using this to configure sendmail's hostname should also work.
  • Locksleyu
    Locksleyu over 10 years
    I tried masquerade_envelope and masquerade_entire_domain but those didn't help either. I finally got it to work by adding -f to sendmail with any address. However I don't understand why is is required. If someone can explain why this matters I'd appreciate it. I am already setting the 'From:' header, and masquerade_envelope also should be doing something similar if I understand correctly.
  • AnFi
    AnFi over 10 years
    MASQUERADE_AS(...) and FEATURE(masquerade_envelope) [and optionally FEATURE(allmasquerade)] should fix the problem. You may use sendmail -Am -vt < mail.txt as root to test it.
  • Locksleyu
    Locksleyu over 10 years
    I was still seeing strange behavior with command line sendmail(), but when I switched to PHP's mail() function (which uses sendmail()), it worked great. Not sure why but I'm happy!