• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

setEnvelopeFrom cannot find symbol

 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, I receive the following exception...



with this code. I also tried setSender(..) and receive the same error. Is there anything obvious here, it seems straight-forward and I've been banging my head on this for two days...thank you so much for reading...



 
Thomas Griffith
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I also tried casting to SMTPAddress...



and receive this... it's like something is missing from the javamail jar...

 
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe I'm looking at the wrong version of the docs, but the one I'm looking at doesn't support a method named "setEnvelopeFrom". Plus, I'm not sure what that's supposed to do for you anyway.
 
Rancher
Posts: 5035
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have the import statement for the SMTPMessage class?
My very old doc(2010 javamail-1.4.3) shows:


com.sun.mail.smtp
Class SMTPMessage

java.lang.Object
 extended by javax.mail.Message
     extended by javax.mail.internet.MimeMessage
         extended by com.sun.mail.smtp.SMTPMessage

 
Thomas Griffith
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, Tim, trying to set up a delivery fail bounce back email addy so they are sent there (bounced_sales@acme.com) rather than sales@acme.com... I think setSender is the easier way but I get the same error.

I added this to for the SMTPMessage which apparently has setEnvelopeFrom...



made the above error chill but now I get



on this line



 
Tim Holloway
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ooops. Missed the cast. But the argument to setEnvelopeFrom is a simple string, not one of those fancy javamail objects.
 
Thomas Griffith
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tim fixed the error because the arg for setEnvelopeFrom is a string, so it compiles with...



not sure it'll run so will be checking that out. I'm not sure why setSender can't work for entering the bounces_sales@acme.com in the message header, that seems more efficient.

ah, runtime error on the above cast...



this is frustrating. ugh. Just trying to send the return address across to handle the bounces.
 
Sheriff
Posts: 4641
582
VSCode Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had this problem a while back when building a list server and solved it using a creating an instance of Session by passing in properties including mail.smtp.from.  I am just leaving for work so I can't dig into now, but here's the code (more than what you need) that I used to create the Session which supported envelope from.

In the list server's delivery agent, a session was creating with:
 
Tim Holloway
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just an observation. Doubtless you've seen emails from "orders.amazon.com" saying your credit card has just been billed $779 and call this number to cancel. But if you actually expand the headers, you'll see that the "sent from" address is "scuzzbag.info" or something like that.

One is the claimed sender ID, but the other is the actual ID that the sending mailserver required its client to connect as. So that should explain the difference.
 
Thomas Griffith
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you, Ron and Tim. Would these two lines overwrite the other?...the session Property and the message.setRecipients...

props.setProperty("mail.smtp.from", username_bounced);
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(original_recipient));
 
Tim Holloway
Saloon Keeper
Posts: 28319
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Thomas Griffith wrote:thank you, Ron and Tim. Would these two lines overwrite the other?...the session Property and the message.setRecipients...

props.setProperty("mail.smtp.from", username_bounced);
message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(original_recipient));


I'm confused there. One says "from", the other says "recipients" (to). So no apparent conflict. Although here again, the recipients should be one or more Strings, I believe.
 
Seriously? That's what you're going with? I prefer this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic