Hi
I am doing a task of mail sending from different mail id's to different mail id's . I have a domain of rediif. when i am sending mail using my domain id then all mails are sent successfully but from other mail ids its not .. can anyone help me for that. TIA.

Dani AI

Generated

Short answer: the hosting SMTP server usually enforces what "From" addresses you may use, so is correct — this is most often a hosting / SMTP relay restriction rather than an ASP.NET bug.

Practical checks and fixes for :

  • Reproduce the problem and capture full message headers on the recipient side (look for Return-Path, Received lines and Authentication-Results). That shows the envelope sender used by the SMTP server and whether the server rewrote or rejected your claimed From.
  • Try sending with the hosting provider's SMTP account (authenticate) and put the address you want in the Reply-To header. Many hosts allow authenticated SMTP but disallow arbitrary From headers.
  • If you control the other domain(s), add an SPF record authorizing the host to send for that domain; otherwise receiving servers may drop or mark the mail as spoofed. See RFC 7208 for how SPF works (RFC 7208).

ASP.NET 1.x specifics: System.Web.Mail wraps CDO and you can enable authenticated SMTP in code by setting the CDO configuration fields before calling SmtpMail.Send. See the System.Web.Mail docs for the MailMessage object for reference (System.Web.Mail.MailMessage). Example pattern (C#):

using System.Web.Mail;

MailMessage mail = new MailMessage();
mail.From = "hosted@yourdomain.com";
mail.To = "recipient@example.com";
mail.Subject = "Test";
mail.Body = "Test body";

mail.Fields[""] = "smtp.host.com";
mail.Fields[""] = 587;
mail.Fields[""] = 2;
mail.Fields[""] = 1;
mail.Fields[""] = "smtpuser";
mail.Fields[""] = "smtppassword";
mail.Fields[""] = true;

SmtpMail.SmtpServer = "smtp.host.com";
SmtpMail.Send(mail);

If the host refuses to allow other From addresses even when authenticated, ask them to enable relay for your account or use the host-approved From and Reply-To, or switch to an external transactional SMTP service that supports sending on behalf of other domains. Do not hardcode SMTP credentials in source; store them in protected config.

Recommended Answers

All 2 Replies

it has to do with your hosting settings, you can send email to anyone but just from hosting firm's provided email address. Contact your hosting administrator if they provide any answers.

Thanks for your reply. i will check for it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.