How Can I Send Emails To Registered Members in MyDatabase? - asp.net

I'm Using Sql Server 2008.
I've a created a database named "Sankal_Residency"
There is a Table named "Member_Details" in which I have stored all members Email Id.
So now I want to send them Mail (LIke .Pdf, .Doc,) or any simple message like new letter
for a selected persons and also all the registered members.
How to achieve this?
Thanks!

You can use sp_send_dbmail stored procedure to send e-mail.
http://technet.microsoft.com/en-us/library/ms190307.aspx
You first need to create a profile and account for sending e-mails.
The account would be associated to profile and the profile is used as a parameter while sending e-mail.
The basic parameters that you will need to provide are:
#profile_name: Name of the profile that you have created in Database Mail
#recipients: If you want to include all recipients in a single e-mail, use semi-colon separated e-mail IDs
#subject: The subject of e-mail
#body: The content of e-mail
Depending on content of e-mail and attachments, you may want to use #body_format and #file_attachments parameters.
In order to create Database Mail profile and accounts, refer to the following link:
http://technet.microsoft.com/en-us/library/ms187605.aspx

If you are preferring the ASP.NET for sending emails, this link would be useful for it: http://hightechnology.in/how-to-send-multiple-emails-from-database-in-asp-net-using-c/
Tutorial in above link will send email to email addresses stored in the database one by one using foreach loop.
And if you want to attach the file with the email, simply use Attachment collection like this:
mailMessage.Attachments.Add(new Attachment(Server.MapPath("~/image.jpg")));
In above example, I have attach a file called "image.jpg", located in the root of the ASP.NET website. By this method, you can attach multiple files with one email.

Related

Multiple Database Usage, Second Connection After Login

There is a scenario like in the picture. There is a common database. Customers are connecting to the same database. After the connection, company-specific information is kept in a separate database. The connecting string is pulled from the company information in the database after the user logs in. How can I do this logic in .net core. I'm new and need ideas.
Click to see the script
When the user logs in, company information is also taken as in the picture.
Click for user company information
I can't define it in the "startup.cs" file because the user needs to be logged in.
Where and how can I define the connecting clause? Can you give an idea?
Startup.cs file
appsettings.json file
login method
In the login method, I need to migrate first. To create the tables. If there are tables, I need to connect to the company's product table. Can this special link be added to swagger too?
Specifically within .net core project you can utilise DBFactoryBase class, and create a constructor which accept appsettings json key to fetch another connection string.

Automate account creation by joining mailing list?

I'm using Wordpress/WooCommerce where users can join the mailing list in MailChimp. But is there a way to also automate account creation after they join the mailing list and generate a temporary password to be sent via email?
Yes, it's possible. Look into MailChimp webhooks.
Basic flow would be:
1. User subscribes
2. MC sends post request to specified callback URL (you can make a page with custom template for example. Easiest way) upon subscription
3. Your page at specified callback URL accepts JSON sent by MC
4. Create new account
5. Send generated password to email
Optionally, you can also set up unsubscribe webhook and remove account when that happens.

Can we use single sign on for diffrent Form Authentication Sites?

I have 2 different websites
-> webgrants.com
->calgrants.com can be accessed directly or from webgrants
there is link provided for calgrants.com in Webgrants.com
so how can i validate the credentials of user when they click on the link provided. how can i do this .urgent please
There might be better ways to do it, but off the top of my head you can do this:
Assuming they have access to the same(or a common) database you create a table of userId and ticket.
Whenever a user wants a redirection to other website, you create a random value(ticket) and assign that value to the user and store this pair into the database.
You add this ticket to address of the other website, as a parameter. Other website checks the table for that 'ticket' and authenticates the user.

ASP.Net Email and Account validation

i was wondering if any one can advise me on how i can go about implementing a email and account validation feature in my ASP.net website. so when a user creates an account, an email is sent to the email address used, and the user needs to verify that email address to be able to logon.
thanks
Suggested workflow..
Create an account for the user in your database and mark the account as "to be validated"
Produce a random key, maybe a GUID and add it to the users account
Email the random key to the user along with a unique URL, e.g www.myurl.com/validateuser.aspx?userid=45532
To email using asp.net use the system.net.mail namespace - lots of bits on the internet about this.
On validateuser.aspx ask user to enter key sent to them in email.
Check if keys match. If so update db record to "validated"
Edit
By the way, there is a nice answer here on Stack Overflow if you are using forms auth
you can use regular expression of email id check after validation save id in database and and on button behind code of registration write code for sending email using system.net.mail
many email sending function available on internet.
after registeration using coding to check on logon either the email exists in ur database or not.
This is almost a year too late, but for the records you should use the built-in ASP.NET Membership functionality because you get all this (and much more) for free, no need to make e-mail validation logic if it's already made for you is it?
http://msdn.microsoft.com/en-us/library/yh26yfzy.aspx

Email Application Question

I have created some webforms that will allow users to fill in their data. Afterwards, the information is processed and inserted into a database with a follow up email to me afterwards letting me know who signed up.
The problem is that I use different email addresses on all of these webforms.
What I would like is some sort of dashboard email application where I can view all the emails being sent to me from one central point.
I think that Thunderbird allows you to receive multiple emails from different accounts. Is something like this even possible?
You can configure just about any email application to receive mail from multiple accounts. Thunderbird does this as does outlook (not outlook express). Just go through the normal process you do to add an account, then go ahead and add another account under a different email address.
Here's a link to a walk through on how to do this on Thunderbird.

Resources