ASP.NET - sending mail form different domain than SMTP credentials? - asp.net

When sending email using MailClient, is it possible to have the .From property be for an email of a different domain than the credentials passed to the SMTP server? E.g., my credentials passed in are #mydomain.com, but the .From email is #anotherdomain.com. Or, must they be the same? Thanks.

You can specify anything you want as the From address! However it might make it more likely that your message winds up in spam or blocked by a spam firewall.

Related

How do I connect a SMTP with Firebase?

Instead of using the built-in email system in Firebase, I wanted to use a SMTP called SMTP2Go but was wondering how to connect it and if need to buy my own email domain first or not? What requirements are needed to connect a SMTP to Firebase?
I assume you're trying to set up a custom SMTP server for sending (verification, password reset, email change) emails from Firebase Authentication. You can set a custom SMTP server in the Firebase Authentication console.
You don't need a custom domain for this. All you need to know is the SMTP host and port of SMTP2GO (something like mail.smtp2go.com and 587), and your account details from them (the username/password you use to log into smtp2go with).
The Sender address field is just what recipients see in the "From" field of the email, and also where any replies they send will be going. It can be whatever address you want to use to support your users.
If you would like to use the Gmail account as SMTP service for Firebase following steps might help you with that. I have shared a medium post about it if you would like to have more details.
Enable the 2 step verification for the G Suite account.
Create an app password for the account.
Allow users to manage their access to less secure apps
Unlock the captcha
The G-Suite account is ready to be used as an SMTP service for firebase.
Check this link please for more details.

Gmail cannot receive wordpress email

I trying to send email to my gmail, but I cannot see the email in my gmail. I also tried to send the email to my hotmail, it is working when send to hotmail.
How do I fix this problem?
Thanks
Today, email service providers are very string with spam. I think your mail that you sended with wordpress is in your Gmail spam folder. You're maybe sending it from localhost or something like that. So Gmail put it by default to the spam folder. You can recover that by mapping a public domain name on your smtp server or like #raman-kuman's answer, you can use a plugin like Postman SMTP plugin to configure an email service like Gmail or Hotmail. If you use another famous email service, you can maybe find the settings here.
I would highly recommend you to use a personal mail server, so you can personalize your email like:
no-reply#my-awesome-domain.name for a notification
contact#my-awesome-domain.name for contact
...
It's looks better than my-awesome-company#gmail.com.
It's most likely to do with :
1.) Your SMTP relaying settings within Wordpress. Check how it's configured and post a new question if you're struggling to get them to work. If your using a SMTP relay service then confirm these credentials are correct.
2.) The email address you are sending out as. If your sending as GMAIL or Hotmail e.g. administrator#hotmail.com from Wordpress using the PHP to send mail then it maybe be sending the mail from the IP address of your webserver which will not be part of the Hotmail/Gmails SPF record so recipient servers would block you on connection.
Make sure your email address that is sending from WordPress is the same as your domain name - something like wordpress#yourwebsite.com, otherwise use the Postman plugin, it will take a bit of configuration but you will be able to send to anywhere.
You can use Gmail's SMTP using Postman SMTP plugin, it works for all..

how to send email in wordpress not using plugin

I am new developer in wordpress. I wanna send email not using plugin . i use function wp_mail as shown below:
wp_mail('myname#yahoo.com', 'subject', 'message', $headers);
when i use yahoo email myname#yahoo.com i can send 'subject,messege' to my yahoo account. but when i use gmail email xxx#gmail.com i can't send 'subject,messege' to my gmail account.why can not send with gmail account? pleas help me !
As you have problem with only Gmail we can infer that it is not the problem with 'sending' but with 'receiving'. Something is blocking your mail at the receiving end. Following things can be done to ensure better receiption.
Use a real address. Dafult is wordpress#yourdomain.com. This can be filtered with wp_mail_from.
Use SMTP to send email. You can do this with phpmailer_init action.
Disable headers.
Contact hosting providers and confirm that your server is not blacklisted by Gmail.
If you used wp_mail to send your message, without a plugin, this means you didn't use Google's SMTP server. And you're wondering why you didn't receive it at your gmail account? Because you basically forged your from address. Of course Google rejected your email.
The only way to get that to work is to use authentication when sending your mail. That means connecting to the smtp.gmail.com server and in 2015 that means using OAuth 2.0 unless you want to deal with another can of worms.
Check out Postman SMTP for sending mail in WordPress.
Here's some reading for you to do: http://googleappsdeveloper.blogspot.no/2014/10/updates-on-authentication-for-gmail.html

Web service to check existence of email?

I have my little web application, with simple registration strategy - provide email and password and you are done.
Recently bot's starting to attack my application, registering big number of users from non existent emails using the same passwords.
I want to prevent that. My idea is to extend login verification, but check the existance of email address. Do you know any web services (prefereably WCF) that could do that?
This is definitely not the way to solve this problem. Try one of these
Allow user to enter only username and send auto-generated password to their email.
Send a verification link to the user email and approve him/her only after verification
This has been discussed on How to check if an email address exists without sending an email? . Basically there are ways verify email addresses, but in practice none of them is reliable. However, you can still check via SMTP, and if the server denies the existence of the expected user, send him an email with a verification link anyway. This does not prevent spammers from setting up fake servers that acknowledge the existence of any user, of using other peoples email addresses, but it's probably the closest you can get to your initial requirement of having no verification email.
I would recommend you to update your registration form. Try to use something tricky for bots. For example, post the form via AJAX with JSON object wrapper.
Try a service like: http://elasticemail.com/
You can use the api to check if the email was delivered. There is also a 'bouce list' you can check.

ASP.NET SMTP and Gmail

The question: Is it possible to configure multiple SMTP servers or update the SMTP object server information at runtime?
Description of problem: The site I'm working on has a few pages which send emails. Our site is using Gmail so even though it's a custom domain our email is sent out though Gmail SMTP servers.
Some emails come from the system and some emails come from users in certain groups. I have an SMTP server configured with the admin email for the system e.g. admin#mysite.com This works fine and when I get the email it shows from admin#mysite.com
One of our user groups let's call it "groupA" has an email configured on our domain i.e. groupA#mysite.com When I send the email and specify a from address for the MailMessage object as groupA#mysite.com it still shows up in my outlook as coming from admin#mysite.com I did a little further testing and if I specify both the from address and the ReplyTo as groupA#mysite.com it will show as From=admin#mysite.com but when I choose reply in outlook it shows groupA#mysite.com My best guess is that Gmail is overwriting the From address with the SMTP user to prevent email spoofing.
I found this: http://www.systemnetmail.com/faq/4.1.aspx but it won't work for me since group A, B, and C all need to send emails from the same page.
To my knowledge, it's impossible to fake the "from" address when using gmail.
Even if you use apps premiere, and set up address aliases, it still says "sent on behalf of ".
system.net.mail configuration in web.config only supports one config
you can easily create your own custom config and configure email server settings at runtime, like so:
SmtpClient smtp = new SmtpClient("smtp.gmail.com");
smtp.Port = 465;
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.UserCredentials = new System.Net.NetworkCredential("yourusername", "yourpassword");
smtp.Send(mail);
you can obviously store yourusername and yourpassword in app settings

Resources