Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending from different email addresses? #27

Closed
qbantek opened this issue Sep 29, 2011 · 10 comments
Closed

Sending from different email addresses? #27

qbantek opened this issue Sep 29, 2011 · 10 comments

Comments

@qbantek
Copy link

qbantek commented Sep 29, 2011

My application sends notifications from different email addresses (sales@xxx.com, alerts@xxx.com, etc). How can I set a different [To] email (and even a different SMTP server) from code?

@smsohan
Copy link
Owner

smsohan commented Sep 29, 2011

Just set a custom from address in your mailMessage object inside your mailer. Here's an example:

class MyMailer extends MailerBase{
public MailMessage Welcome(){
var mailMessage = ....;
mailMessage.From = "sales@seller.com"
return mailMessage;
}
}

@smsohan smsohan closed this as completed Sep 29, 2011
@qbantek
Copy link
Author

qbantek commented Sep 29, 2011

thanks

@qbantek
Copy link
Author

qbantek commented Sep 29, 2011

Sorry about my previous question. I didn't explain myself properly: since i am using Gmail, I would like to use different credentials for every different account. I can change the FROM field but if I use the same SMTP account the email will still show as originating from another account. Is there a way to specify different SMTP accounts/settings for each message? Thanks a lot!

@smsohan
Copy link
Owner

smsohan commented Sep 29, 2011

Use a smtpclient instance to send your email. That way you can
configure it per mail.


Sent from my iPhone
S M Sohan

On 2011-09-29, at 4:59 PM, qbantek
reply@reply.github.com
wrote:

Sorry about my previous question. I didn't explain myself properly: since i am using Gmail, I would like to use different credentials for every different account. I can change the FROM field but if I use the same SMTP account the email will still show as originating from another account. Is there a way to specify different SMTP accounts/settings for each message? Thanks a lot!

Reply to this email directly or view it on GitHub:
#27 (comment)

@ghost
Copy link

ghost commented Oct 9, 2013

This is not working for me at all. I am setting the mailmessage with a different FROM address and then it fails on the send. This email should have the same credentials as the account specified in the web config for the mailer.

@smsohan
Copy link
Owner

smsohan commented Oct 9, 2013

Check the details of the smtpClient you are using. If you are creating the instance, check if it gets the configs applied to it. If you want, for a nominal consultation fee, I can look at your specific code and help you reach a solution.

@ghost
Copy link

ghost commented Oct 9, 2013

Thank you! Stepping out for the afternoon, but I will get back with you
tomorrow, if that's okay.

On 10/9/2013 3:29 PM, SM Sohan wrote:

Check the details of the smtpClient you are using. If you are creating
the instance, check if it gets the configs applied to it. If you want,
for a nominal consultation fee, I can look at your specific code and
help you reach a solution.


Reply to this email directly or view it on GitHub
#27 (comment).

@ghost
Copy link

ghost commented Oct 9, 2013

The owner of the exchange server says that the email address is inbound
only. Will that make it fail using mvc mailer?

On 10/9/2013 3:29 PM, SM Sohan wrote:

Check the details of the smtpClient you are using. If you are creating
the instance, check if it gets the configs applied to it. If you want,
for a nominal consultation fee, I can look at your specific code and
help you reach a solution.


Reply to this email directly or view it on GitHub
#27 (comment).

@smsohan
Copy link
Owner

smsohan commented Oct 9, 2013

That'll make it fail to send a mail anyway.


Sent from my iPhone
Sohan SM

On Oct 9, 2013, at 2:37 PM, janessaallen notifications@github.com wrote:

The owner of the exchange server says that the email address is inbound
only. Will that make it fail using mvc mailer?

On 10/9/2013 3:29 PM, SM Sohan wrote:

Check the details of the smtpClient you are using. If you are creating
the instance, check if it gets the configs applied to it. If you want,
for a nominal consultation fee, I can look at your specific code and
help you reach a solution.


Reply to this email directly or view it on GitHub
#27 (comment).


Reply to this email directly or view it on
GitHubhttps://github.com//issues/27#issuecomment-26006387
.

@ghost
Copy link

ghost commented Oct 9, 2013

Okay, thank you so much for the information.

On 10/9/2013 4:38 PM, SM Sohan wrote:

That'll make it fail to send a mail anyway.


Sent from my iPhone
Sohan SM

On Oct 9, 2013, at 2:37 PM, janessaallen notifications@github.com
wrote:

The owner of the exchange server says that the email address is inbound
only. Will that make it fail using mvc mailer?

On 10/9/2013 3:29 PM, SM Sohan wrote:

Check the details of the smtpClient you are using. If you are creating
the instance, check if it gets the configs applied to it. If you want,
for a nominal consultation fee, I can look at your specific code and
help you reach a solution.


Reply to this email directly or view it on GitHub
#27 (comment).


Reply to this email directly or view it on
GitHubhttps://github.com//issues/27#issuecomment-26006387

.


Reply to this email directly or view it on GitHub
#27 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants